[Fixed]-Python interpreter PATH oddity. Can't use django

1👍

Because python 2.7 path is set in the system environment variable PATH. You are editing your user variables (which are bizarrely configured because they contain duplicate stuff only found in system path like C:\windows\system32 for instance)

if you type where python you’ll probably get:

C:\Python27\python.exe

(EDIT: you actually get that value, since you answered to my comment)

if you type where pip you’ll probably get:

C:\users\jackf_000\sw\anaconda2\scripts\pip.exe

which explains that pip installs package in the anaconda2 package

To get anaconda python in your path you would need to add C:\users\jackf_000\sw\anaconda2 not the scripts subdir that contain pip.

then, if you typed where python you’ll probably get:

C:\Python27\python.exe
C:\users\jackf_000\sw\anaconda2\python.exe

But that wouldn’t be enough because..

The system path comes first. PATH is one special env variable that you dont override with your user profile, only append dirs to. And it’s perfectly normal to have one user PATH variable and one system PATH variable.

On the other hand, let’s say the system variable PYTHONPATH does not please you, you could choose to replace it by setting a completely different one in your user variables. That would replace the paths, not append to them, unless you add ;%PYTHONPATH% somewhere (PYTHONPATH is a path variable, but unknown by windows, it’s nothing special). And PYTHONPATH does not influence which executable will be loaded, so forget it for now.

2 solutions:

  1. modify system path (admin needed) to add anaconda is before python 2.7 (not recommended)
  2. run your applications which require anaconda with a .bat file starting by the following:

    set PATH=C:\users\jackf_000\sw\anaconda2;%PATH%
    rem now run the command which needs anaconda python first

Leave a comment