On Ubuntu 18.04, I installed Python 3.7 and a virtual environment in /home/sss/dev/venv/3.7
The venv site packages are in /home/sss/dev/venv/3.7/lib/python3.7/site-packages
-
~/dev/venv/3.7/bin/python -m site
sys.path = [
'/home/sss/dev',
'/usr/lib/python37.zip',
'/usr/lib/python3.7',
'/usr/lib/python3.7/lib-dynload',
'/home/sss/dev/venv/3.7/lib/python3.7/site-packages',
]
USER_BASE: '/home/shane/.local' (exists)
USER_SITE: '/home/shane/.local/lib/python3.7/site-packages' (exists)
ENABLE_USER_SITE: False
Next, I created a symbolic link in my home directory targeting the Python interpreter in the virtual environment -
ln -s /home/sss/dev/venv/3.7/bin/python ~/py
ls -l py
lrwxrwxrwx 1 sss sss 35 feb 5 08:52 py -> /home/sss/dev/venv/3.7/bin/python
but when I use this link in place of /home/sss/dev/venv/3.7/bin/python
, I would expect it to have access to packages in /home/sss/dev/venv/3.7/lib/python3.7/site-packages
, but this is not the case -
./py -m site
sys.path = [
'/home/sss/dev',
'/usr/lib/python37.zip',
'/usr/lib/python3.7',
'/usr/lib/python3.7/lib-dynload',
'/home/sss/.local/lib/python3.7/site-packages',
'/usr/local/lib/python3.7/dist-packages',
'/usr/lib/python3/dist-packages',
]
USER_BASE: '/home/sss/.local' (exists)
USER_SITE: '/home/sss/.local/lib/python3.7/site-packages' (exists)
ENABLE_USER_SITE: True
Is there a work-around to this problem?