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
Adding Python and PythonPath to the Windows environment:
Under 'System Variables':
Add
PY_HOME
PYTHONPATH
Append
path
Windows 7 Professional I Modified @mongoose_za's answer to make it easier to change the python version:
Add the following to the existing variable:
%PY_HOME%;%PY_HOME%\Lib;%PY_HOME%\DLLs;%PY_HOME%\Lib\lib-tk;
Click [OK] to close all of the windows.
As a final sanity check open a command prompt and enter python. You should see
If you need to switch between versions, you only need to modify the PY_HOME variable to point to the proper directory. This is bit easier to manage if you need multiple python versions installed.
From Windows command line:
To set the PYTHONPATH permanently, add the line to your
autoexec.bat
. Alternatively, if you edit the system variable through the System Properties, it will also be changed permanently.This
PYTHONPATH
variable needs to be set forArcPY
when ArcGIS Desktop is installed.PYTHONPATH=C:\arcgis\bin
(your ArcGIS home bin)For some reason it never was set when I used the installer on a Windows 7 32-bit system.
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 haveC:\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
along with it. Else it will never work.
In Python 3.4 on windows it worked when I added it to PATH enviroment variable instead of PYTHONPATH. Like if you have installed Python 3.4 in D:\Programming\Python34 then add this at the end of your PATH environment variable
Close and reopen command prompt and execute 'python'. It will open the python shell. This also fixed my Sublime 3 issue of 'python is not recognized as an internal or external command'.