无法使用easy_install安装Python模块

无法使用easy_install安装Python模块,python,module,installation,setuptools,easy-install,Python,Module,Installation,Setuptools,Easy Install,我正在尝试使用easy\u install安装一个名为requests的模块 easy_install requests 一周前,当我使用Python2.6.5时,它工作得很好,但今天我安装了Python2.7.2,然后尝试在我的一个脚本中导入请求,但失败了。然后,我尝试使用easy\u install requests重新安装请求,但出现了此错误 install_dir /usr/local/lib/python2.6/dist-packages/ error: can't create o

我正在尝试使用
easy\u install
安装一个名为requests的模块

easy_install requests
一周前,当我使用Python2.6.5时,它工作得很好,但今天我安装了Python2.7.2,然后尝试在我的一个脚本中导入请求,但失败了。然后,我尝试使用
easy\u install requests
重新安装请求,但出现了此错误

install_dir /usr/local/lib/python2.6/dist-packages/
error: can't create or remove files in install directory

The following error occurred while trying to add or remove files in the
installation directory:

    [Errno 13] Permission denied: '/usr/local/lib/python2.6/dist-packages/test-easy-install-15207.pth'

The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:

    /usr/local/lib/python2.6/dist-packages/

Perhaps your account does not have write access to this directory?  If the
installation directory is a system-owned directory, you may need to sign in
as the administrator or "root" account.  If you do not have administrative
access to this machine, you may wish to choose a different installation
directory, preferably one that is listed in your PYTHONPATH environment
variable.

For information on other options, you may wish to consult the
documentation at:

  http://packages.python.org/distribute/easy_install.html

Please make the appropriate changes for your system and try again.
所以我被告知去重新安装easy_install,我去了,并学会了我必须去

从数据库中删除所有setuptools*.egg和setuptools.pth文件 系统的站点包目录(以及任何其他sys.path目录) 首先

所以我做了这个。然后,我从
setuptools-0.6c11-py2.7.egg
重新安装了setuptools。它似乎成功了,但是当我运行
easy\u install requests
时,我得到了基本相同的错误,除了目录python2.6/dist-packages现在是python2.7/site-packages

siddhion@siddhion-laptop:~$ easy_install requests
error: can't create or remove files in install directory

The following error occurred while trying to add or remove files in the
installation directory:

    [Errno 13] Permission denied: '/usr/local/lib/python2.7/site-packages/test-easy-install-16253.write-test'

The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:

    /usr/local/lib/python2.7/site-packages/

Perhaps your account does not have write access to this directory?  If the
installation directory is a system-owned directory, you may need to sign in
as the administrator or "root" account.  If you do not have administrative
access to this machine, you may wish to choose a different installation
directory, preferably one that is listed in your PYTHONPATH environment
variable.

For information on other options, you may wish to consult the
documentation at:

  http://peak.telecommunity.com/EasyInstall.html

Please make the appropriate changes for your system and try again.
另外,当我执行
easy\u install
并按tab键时,我会得到这些选项

easy_install      easy_install-2.6  easy_install-2.7
为什么会有easy_install-2.6


我怎样才能让简易安装重新工作?

您是否尝试过像这样使用
sudo

sudo easy_install requests
或者将安装目录指定给您具有写入权限的目录

easy_install --install-dir=/home/foo/bar

但是你真的应该使用而不是
easy\u install
。它更好,功能也更多。

您应该在基于包的Linux发行版上使用
virtualenv
,这样Python脚本就不会干扰其他包或与操作系统的包管理器冲突


以下是我在Ubuntu 12.10上安装easy\u install时所做的工作:


您是否尝试将新的python.framework添加到path? 关于山狮,我补充道
/Library/Frameworks/Python.framework/Versions/3.3/bin/
/etc/path

然后我就可以使用easy_install-3.3和pip-3.3了,这可能是一个简单的例子,你前面没有“sudo”。你能用sudoeasy安装请求试试吗


放置“sudo”将添加所需的权限。

easy\u install
之前使用
sudo
可以解决您的问题

Sudo easy_install requests

谢谢

是的,我有sudo easy\u安装请求,但这也不起作用。关键是,我的Python路径似乎有问题。我认为easy_install或Python 2.7.2正在错误的路径上搜索。与python2.7.2类似,它在python2.6/dist-packages目录中查找。不确定。我也在浏览这个,没有
sudo
,否则我就用它。
Sudo easy_install requests