Custom modules do not load at first (Python)

I installed Pandas version 0.12.0 on the site and the user needs 0.13.0. I told him to install it in his home directory, which he made, but when he types import pandas, he finds the old module.

So, I decided to print it out sys.pathand noticed these paths in that order (others were deleted to save this message):

[
    '',
    '/apps/python/2.7.5/lib/python2.7/site-packages/pandas-0.12.0-py2.7-linux-x86_64.egg',
    '/home/user/.local/lib/python2.7/site-packages',
    '/apps/python/2.7.5/lib/python2.7/site-packages'

]

PYTHONPATH appears after Pandas:

[
    '',
    '/apps/python/2.7.5/lib/python2.7/site-packages/pandas-0.12.0-py2.7-linux-x86_64.egg',
    '/usr/lib64', // this is the PYTHONPATH
    '/home/user/.local/lib/python2.7/site-packages',
    '/apps/python/2.7.5/lib/python2.7/site-packages'

]

What could lead to the fact that pandas -0.12.0 will be specially loaded first of all, even PYTHONPATH? There are several other packages that also exhibit the same behavior. All packages are installed pipor running python setup.py install; can any of the methods cause such a problem? I do not think that we edited something manually.

+4
1

, Python: https://docs.python.org/2/tutorial/modules.html#the-module-search-path. , PYTHONPATH .

, , , pth ( pth PYTHONPATH). https://docs.python.org/2/library/site.html, , . , :

. -S.

PYTHONPATH -S ( Python 2.7.3):

$ export PYTHONPATH="FOO"
$ python -S
>>> import sys
>>> "FOO" in sys.path
True

, , , site.py. PYTHONPATH .

: easy_install/setuptools/distribute. , sys.path, PYTHONPATH, , . https://bugs.launchpad.net/ubuntu/+source/distribute/+bug/821000. , , , .

+1

Source: https://habr.com/ru/post/1544010/


All Articles