使用pip --user选项与创建virtualenv一样安全吗? [英] is using the pip --user option as safe as creating a virtualenv?
问题描述
使用pip install --user
在用户的主目录中安装软件包是否提供与使用virtualenv相同级别的保护,以防止系统破坏性更改?
Does installing packages in the home directory of a user with pip install --user
provide the same level of protection against system-breaking changes as using a virtualenv?
推荐答案
在与
pip install --user
一起使用的主目录中安装软件包是否提供与使用virtualenv
相同级别的保护,防止系统破坏性更改?
Does installing packages in the home directory of a use with
pip install --user
provide the same level of protection against system-breaking changes as using avirtualenv
?
通过系统重大更改",
我想您是指由操作系统的程序包管理器工具安装的程序包.
使用pip
的--user
选项,
软件包将安装在用户的主目录中.
而且由于软件包管理器不应依赖于用户目录,而是仅使用安装在系统中指定位置的软件包,
独立于用户的垃圾,
一个正确管理的系统应该不能使用pip install --user
破坏.
By "system-breaking changes",
I suppose you mean packages installed by the operating system's package manager tool.
With the --user
option of pip
,
packages will be installed in the user's home directory.
And since the package manager is not supposed to depend on user directories, but use only packages installed at the designated location in the system,
independent from users's junk,
a properly managed system should not be possible to break using pip install --user
.
但是,
如果您与用户一起使用多个Python项目,
始终保持使用virtualenv
是有意义的,
以防止项目之间的版本冲突.
However,
if you work with more than one Python project with your user,
it makes sense to always use virtualenv
consistently,
to prevent versioning conflicts between the projects.
这篇关于使用pip --user选项与创建virtualenv一样安全吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!