Reputation: 18657
I have numerous versions of packages installed. My base, system python is ~/Library/Enthought/Canopy_64bit/User/lib/python2.7/
but I also have an application ('yt') which installed its own python to
~/Applications/yt/yt-x86_64/lib/python2.7/
I've added the yt path so that I can import a module which it includes, when I run my system python. The problem is, when I add the yt-path to PYTHONPATH
it adds a ton of other directories, to higher entries in my sys.path
so that when I try to import numpy
(for example), I end up getting the yt-version, instead of my system version.
Is there a way to keep my sys.path
from being modified?
Upvotes: 0
Views: 148
Reputation: 59681
PYTHONPATH
values are always inserted in front of the standard python library paths in sys.path
One potential approach around this problem is to add the yt
path to sys.path
yourself.
So try
# append to the *end* of the system path.
sys.path.append('~/Applications/yt/yt-x86_64/lib/python2.7/path/to/libs')
this will put the yt
specific modules at the end of the list, and your system's numpy
will be found/imported first.
Upvotes: 2