codehaus


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How python knows where non standard libraries are stored ?


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 ?