How to add to the PYTHONPATH in Windows, so it finds my modules/packages?
environment-variables, python, pythonpath, windows
Solution
You know what has worked for me really well on windows.
`My Computer > Properties > Advanced System Settings > Environment Variables >`
Just add the path as C:\Python27 (or wherever you installed python)
OR
Then under system variables I create a new Variable called `PythonPath`. In this variable I have `C:\Python27\Lib;C:\Python27\DLLs;C:\Python27\Lib\lib-tk;C:\other-folders-on-the-path`
This is the best way that has worked for me which I hadn't found in any of the docs offered.
EDIT: For those who are not able to get it, Please add
C:\Python27;
along with it. Else it will never work.
Problem
I have a directory which hosts all of my Django apps (`C:\My_Projects`). I want to add this directory to my `PYTHONPATH` so I can call the apps directly. I tried adding `C:\My_Projects\;` to my Windows `Path` variable from the Windows GUI (`My Computer > Properties > Advanced System Settings > Environment Variables`). But it still doesn't read the coltrane module and generates this error: Error: No module named coltrane
Related problems
- import error: 'No module named' *does* exist
- The Python executable is not recognized on Windows 10
- How to export and import environment variables in windows?
- Where shall I put my self-written Python packages?
- ERROR: Invalid syntax. Default option is not allowed more than '2' time(s). Type "SETX /?" for usage
- How to export and import environment variables in windows?