I have created an anaconda environment. When I activate the environment I can see that the environment is using a different Python version than my default Python version. This is correct. However, when I check python path within the activated environment.
import sys
from pprint import pprint
pprint(sys.path)
I can see that the first 4 items are pointing to the default Python installation.
['', 'C:\\Python27\\Lib\\site-packages\\distribute-0.6.35-py2.7.egg', 'C:\\Python27\\Lib\\site-packages\\ipython-1.0.0-py2.7.egg', 'C:\\Python27\\Lib\\site-packages', 'C:\\Python27\\Lib\\site-packages\\setuptools-0.6c11-py2.7.egg-info', 'C:\\Users\\sennn\\AppData\\Local\\Continuum\\Anaconda32\\envs\\apiapi\\python27.zip', 'C:\\Users\\sennn\\AppData\\Local\\Continuum\\Anaconda32\\envs\\apiapi\\DLLs', 'C:\\Users\\sennn\\AppData\\Local\\Continuum\\Anaconda32\\envs\\apiapi\\lib', 'C:\\Users\\sennn\\AppData\\Local\\Continuum\\Anaconda32\\envs\\apiapi\\lib\\plat-win', 'C:\\Users\\sennn\\AppData\\Local\\Continuum\\Anaconda32\\envs\\apiapi\\lib\\lib-tk', 'C:\\Users\\sennn\\AppData\\Local\\Continuum\\Anaconda32\\envs\\apiapi', 'C:\\Users\\sennn\\AppData\\Local\\Continuum\\Anaconda32\\envs\\apiapi\\lib\\site-packages', 'C:\\Users\\sennn\\AppData\\Local\\Continuum\\Anaconda32\\envs\\apiapi\\lib\\site-packages\\PIL', 'C:\\Users\\sennn\\AppData\\Local\\Continuum\\Anaconda32\\envs\\apiapi\\lib\\site-packages\\Sphinx-1.2.3-py2.7.eg g', 'C:\\Users\\sennn\\AppData\\Local\\Continuum\\Anaconda32\\envs\\apiapi\\lib\\site-packages\\win32', 'C:\\Users\\sennn\\AppData\\Local\\Continuum\\Anaconda32\\envs\\apiapi\\lib\\site-packages\\win32\\lib', 'C:\\Users\\sennn\\AppData\\Local\\Continuum\\Anaconda32\\envs\\apiapi\\lib\\site-packages\\Pythonwin', 'C:\\Users\\sennn\\AppData\\Local\\Continuum\\Anaconda32\\envs\\apiapi\\lib\\site-packages\\runipy-0.1.1-py2.7.eg g', 'C:\\Users\\sennn\\AppData\\Local\\Continuum\\Anaconda32\\envs\\apiapi\\lib\\site-packages\\setuptools-5.8-py2.7. egg']
This creates a problem of importing wrong versions of some of libraries.
Why these default directories have been added to the path? Is this a default behavior when creating a new Anaconda environment? Is there any way to overwrite it?
Check to see if you have the environment variables PYTHONPATH
or PYTHONHOME
set. conda info -a
will also show you all the relevant environment variables that might cause this sort of thing to happen.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With