![]() This seems to be the way most packages get added to the sys.path as opposed to using the PYTHONPATH. pth file and put in any of these directories (including the sitedir as mentioned above). pth files around which can explain some unexpected paths in sys.path: python -c 'import sys print(sys.path)' On a typical system there are a bunch of these. For example easy-install maintains its collection of installed packages which are added to a system specific file e.g on Ubuntu it's /usr/local/lib/python2.7/dist-packages/easy-install.pth. pth config files which contain specific additional search paths. ![]() The site.py script then adds a number of directories, dependent upon the platform, such as /usr//python/dist-packages, /usr/local/lib/python/dist-packages to the search path and also searches these paths for. One can obtain the value of sys.prefix: python -c 'import sys print(sys.prefix)' To give a bit more explanation, Python will automatically construct its search paths (as mentioned above and here) using the site.py script (typically located in sys.prefix + lib/python/site-packages as well as lib/site-python).
0 Comments
Leave a Reply. |