Reputation: 9672
I have a library that is on the pythonpath:
In [2]: import sys
In [3]: sys.path
Out[3]:
['',
...
'/home/cchilders/scripts/python/my_scripting_library',
]
It is registered in ~/.profile:
export PYTHONPATH="${PYTHONPATH}:/home/cchilders/scripts/python/my_scripting_library"
yet when I enter python/Ipython, I can't see it or use it. It has init.py in its highest level. I use kubuntu and suddenly it doesn't work, but anything I pip install does. What can cause this? Thank you
Upvotes: 1
Views: 432
Reputation: 497
The folders on the PYTHONPATH should contain folders that are python packages, and not be the paths to the packages themselves.
In this case, if my_scripting_library is your package, and '/home/cchilders/scripts/python/my_scripting_library' contains the __init__.py file, it will not be valid.
Assuming my_scripting_library is the package you wish to import, ensure the __init__.py file is within '/home/cchilders/scripts/python/my_scripting_library', then the folder on the path should be:
export PYTHONPATH="${PYTHONPATH}:/home/cchilders/scripts/python"
You can then in Python do this:
>>> import my_scripting_library
Upvotes: 2