git.net

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

How python knows where non standard libraries are stored ?


On 9/7/2019 5:51 AM, ast wrote:

> '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 ?

I believe that the short answer, skipping the gory details provided by 
Eryk, is that the result is the same as
os.path.dirname(sys.executable) + r"\lib\site-packages"

You can check if this works for the venv.

-- 
Terry Jan Reedy