Python Forum

Full Version: sys.path miss dist-packages in a virtual env.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I created a virtual enviroment with venv.

And i noticed that :
$ python3
>>> import sys
>>> sys.path
['', '/usr/lib/python35.zip', '/usr/lib/python3.5', '/usr/lib/python3.5/plat-x86_64-linux-gnu', '/usr/lib/python3.5/lib-dynload', '/usr/lib/python3/dist-packages']

But:
chomwitt@enous:~$ cd /var/www/lettersearch/
chomwitt@enous:/var/www/lettersearch$ source .env/bin/activate
(.env) chomwitt@enous:/var/www/lettersearch$ python3
>>> import sys
>>> sys.path
['', '/usr/lib/python35.zip', '/usr/lib/python3.5', '/usr/lib/python3.5/plat-x86_64-linux-gnu', '/usr/lib/python3.5/lib-dynload', '/var/www/lettersearch/.env/lib/python3.5/site-packages']

So my question is , why virtual env can have access to /usr/lib/python3.5 but not to
/usr/lib/python3/dist-packages ?

Thanks
chomwitt
dist-packages is a Debian-specific convention that is also present in its derivatives, like Ubuntu.
Debian Python Wiki:
Quote:dist-packages instead of site-packages.
Third party Python software installed from Debian packages goes into dist-packages, not site-packages.
This is to reduce conflict between the system Python, and any from-source Python build you might install manually.
Means that if you manually install Python from source or make virtual environment,it will use site-packages directory.

As note so has Windows always used site-packages,as folder for 3-party installed modules/package.
Thank you.

The issue came after not finding a mysql driver in pip.
I mean the one from Oracle.