I'd like to include an external library (developed internaly) we are using in our team in Anacoda folder. I know the simple way is to put the package directly into C:/Users/XXX/AppData/Local/Continuum/Anaconda2/Lib/site-packages
.
However I need to keep the library at a different place. One of the answers here suggested to create a .pth
file in the site-packages
, which is solution I like. Therefore I created file name.pth
where there is one line with path of the library C:/path to/whatever/library
. However if I restart Spyder and try to import the library, I get an error
ImportError: No module named XXX
I am thinking that I probably specified the path in a wrong way? Also there is a blank space in the path. Maybe that could be a problem?
[Python 2.7 with Anacodna distribution 4.3.17, Windows 7]
EDIT
So far I found that I can create a .py
file in the site-packages
folder which contains following:
# make path
import sys
sys.path.append('C:/path to/whatever/library')
from packageA import A1, A2, A3
from packageB import B1, B2, B3
If I keep the same name, the import works just fine. But then everytime I add a new package or function, the .py
file must be updated, which is really annoying.