easy_install或pip为受限用户? [英] easy_install or pip as a limited user?

查看:126
本文介绍了easy_install或pip为受限用户?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

标准python distutils提供了用户的选项,这样我就可以以受限用户的身份安装软件包,如下所示:

Standard python distutils provides a '--user' option which lets me install a package as a limited user, like this:

python setup.py install --user

easy_install pip 是否等效?

推荐答案

对于pip,请参见

For pip, see User Installs for details, but basically, it's just what you'd expect:

pip install --user Foo

easy_install有点棘手.正如Ned Deily指出的那样,如果您可以依赖distribute而不是setuptools,并且可以使用0.6.11或更高版本,则可以仅使用与pip相同的--user.但是,如果您需要使用setuptools或更旧的distribute…,请参阅自定义安装位置以获得详细信息(并注意,它解释了如何创建和设置用户站点包,而不仅仅是在那里安装,因为它需要能够与Python 2.5及更早版本配合使用,而在默认情况下,它不会执行此操作).但希望您只将easy_install用于少数无法使用pip的软件包,所以这没什么大不了的.

It's a bit trickier for easy_install. As Ned Deily points out, if you can rely on distribute rather than setuptools, and 0.6.11 or later, you can just use --user the same as pip. But if you need to work with setuptools, or older distribute… see Custom Installation Locations for details (and note that it explains how to create and set up user site packages, not just how to install there, because it needs to be able to work with Python 2.5 and earlier, which didn't do this by default). But hopefully, you're only using easy_install for the handful of packages that aren't pip-able, so that isn't a big deal.

但是,至少值得考虑的是 virtualenv 是否比用户站点更适合您要完成的任务目录. pipvirtualenv可以很好地协同工作,如文档所述

However, it's at least worth considering whether virtualenv is a better fit for whatever you're trying to accomplish than a user site directory. pip and virtualenv work together very nicely, as the docs explain.

这篇关于easy_install或pip为受限用户?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆