/home/sss/dev/venv/3.7
在 Ubuntu 18.04 上,我在venv 站点包中安装了 Python 3.7 和虚拟环境/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
接下来,我在我的主目录中创建了一个符号链接,目标是虚拟环境中的 Python 解释器 -
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
但是当我使用此链接代替时/home/sss/dev/venv/3.7/bin/python
,我希望它可以访问中的包/home/sss/dev/venv/3.7/lib/python3.7/site-packages
,但事实并非如此-
./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
这个问题有解决方法吗?