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 have tried adding C:\My_Projects\;
to my 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
Just append your installation path (ex. C:\Python27\) to the PATH variable in System variables. Then close and open your command line and type 'python'.
The python 2.X paths can be set from few of the above instructions. Python 3 by default will be installed in C:\Users\\AppData\Local\Programs\Python\Python35-32\ So this path has to be added to Path variable in windows environment.
These solutions work, but they work for your code ONLY on your machine. I would add a couple of lines to your code that look like this:
That should take care of your problems
You can also add a
.pth
file containing the desired directory in either yourc:\PythonX.X
folder, or your\site-packages folder
, which tends to be my preferred method when I'm developing a Python package.See here for more information.
You need to add to your PYTHONPATH variable instead of Windows PATH variable.
http://docs.python.org/using/windows.html