安装在root上的包在virtualenv中可用吗?

2024-03-29 02:24:49 发布

您现在位置:Python中文网/ 问答频道 /正文

在处理django项目时,是否可以访问虚拟环境中根用户上安装的包?你知道吗


Tags: 项目django用户虚拟环境
1条回答
网友
1楼 · 发布于 2024-03-29 02:24:49

根据^{} Docs

It creates an environment that has its own installation directories, that doesn’t share libraries with other virtualenv environments (and optionally doesn’t access the globally installed libraries either).

看一下 system-site-packages选项,它允许访问虚拟环境的全局站点包模块。你知道吗

If you build with virtualenv system-site-packages ENV, your virtual environment will inherit packages from /usr/lib/python2.7/site-packages (or wherever your global site-packages directory is).

This can be used if you have control over the global site-packages directory, and you want to depend on the packages there. If you want isolation from the global system, do not use this flag.

希望有帮助。你知道吗

相关问题 更多 >