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
Maybe a little late, but this is how you add the path to the Windows Environment Variables.
Go to the Environment Variables tab, you do this by pressing Windows key + Pausa inter.
Go to Advanced System Settings.
Click on Environment Variables.
On the lower window search for the 'Path' value.
Select it
Click on Edit
In the end of the line add your instalation folder and the route to 'Scripts' folder.
Click ok, aceptar etc.
You're done, enter cmd and write python from any location of your drive, it should enter the Python program.
Example with my pc (I have
Python34
)Hope it helps.
Greetings from Bogotá
These answers are so bad. The installer has a secret option. Click the installer again, uninstall, then reinstall.
For anyone trying to achieve this with Python 3.3+, the Windows installer now includes an option to add python.exe to the system search path. Read more in the docs.
The easier way to set the path in python is : click start> My Computer >Properties > Advanced System Settings > Environment Variables > second windows >
select Path > Edit > and then add ";C:\Python27\;C:\Python27\Scripts\"
link :http://docs.python-guide.org/en/latest/starting/install/win/
To augment PYTHONPATH, run regedit and navigate to KEY_LOCAL_MACHINE \SOFTWARE\Python\PythonCore and then select the folder for the python version you wish to use. Inside this is a folder labelled PythonPath, with one entry that specifies the paths where the default install stores modules. Right-click on PythonPath and choose to create a new key. You may want to name the key after the project whose module locations it will specify; this way, you can easily compartmentalize and track your path modifications.
thanks
This won't persist over reboots or get translated to other files. It is however great if you don't want to make a permanent modification to your system.