How python knows where non standard libraries are stored ?

ast none at gmail.com
Sat Sep 7 05:51:36 EDT 2019


Hello

List sys.path contains all paths where python shall
look for libraries.

Eg on my system, here is the content of sys.path:

 >>> import sys
 >>> sys.path
['',
'C:\\Users\\jean-marc\\Desktop\\python',
'C:\\Program Files\\Python36-32\\python36.zip',
'C:\\Program Files\\Python36-32\\DLLs',
'C:\\Program Files\\Python36-32\\lib',
'C:\\Program Files\\Python36-32',
'C:\\Program Files\\Python36-32\\lib\\site-packages']

The last path is used as a location to store libraries
you install yourself.

If I am using a virtual environment (with venv) this last
path is different

'C:\\Users\\jean-marc\\Desktop\\myenv\\lib\\site-packages'

I looked for windows environment variables to tell python
how to fill sys.path at startup but I didn't found.

So how does it work ?



More information about the Python-list mailing list