Python Forum
sys.path miss dist-packages in a virtual env.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
sys.path miss dist-packages in a virtual env.
#1
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
Reply
#2
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.
Reply
#3
Thank you.

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


Possibly Related Threads…
Thread Author Replies Views Last Post
  Installing python packages in a virtual environment Led_Zeppelin 1 768 Aug-15-2023, 08:18 PM
Last Post: deanhystad
Photo exe created by pyinstaller only works in the dist directory dee 7 2,813 Feb-23-2023, 05:53 PM
Last Post: dee
  WebDriverException: Message: 'PATH TO CHROME DRIVER' executable needs to be in PATH Led_Zeppelin 1 2,215 Sep-09-2021, 01:25 PM
Last Post: Yoriz
  Virtual environment path? Led_Zeppelin 1 2,306 Jul-22-2021, 01:40 PM
Last Post: snippsat
  sys.path for virtual environment ErnestTBass 2 2,561 Sep-10-2020, 06:36 PM
Last Post: ErnestTBass
  Virtual environment base folder is not add to sys.path on Linux AbdelrahmanMSaid 0 1,969 Mar-16-2020, 11:44 PM
Last Post: AbdelrahmanMSaid
  I always get 'None' returned. Confused. What did I miss? jpezz 2 2,386 Apr-07-2019, 10:06 AM
Last Post: jpezz
  jira-2.0.0.dist causing error with py2exe johnlawlor 1 2,528 Aug-09-2018, 08:27 PM
Last Post: Larz60+
  .pth file does not show up in sys.path when configuring path. arjunsingh2908 2 5,774 Jul-03-2018, 11:16 AM
Last Post: arjunsingh2908

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020