问题描述
我正在尝试使用
easy_install requests
一周前,当我使用Python 2.6.5时,此方法运行良好,但今天我安装了Python 2.7.2,然后尝试在我的一个脚本中执行import requests
,但失败了.然后,我尝试使用easy_install requests
重新安装请求,但收到此错误
This worked fine a week ago when I was using Python 2.6.5 but today I installed Python 2.7.2 and then tried to import requests
in one of my scripts but it failed. I then tried reinstalling requests with easy_install requests
but got this error
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,然后转到 http://pypi.python.org/pypi/setuptools ,并得知我必须
So I was told to go reinstall easy_install and I went to http://pypi.python.org/pypi/setuptools and learned I had to
所以我做到了.然后,我从setuptools-0.6c11-py2.7.egg
重新安装了setuptools.看起来很成功,但是当我运行easy_install requests
时,除了出现目录python2.6/dist-packages现在是python2.7/site-packages
So I did this. I then reinstalled setuptools from the setuptools-0.6c11-py2.7.egg
. It seemed successful but when I ran easy_install requests
I got basically the same error except the directory python2.6/dist-packages is now 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_install
并按Tab键时,我会得到以下选项
Also, when I do easy_install
and press tab I get these options
easy_install easy_install-2.6 easy_install-2.7
easy_install-2.6为何出现?
How come easy_install-2.6 is there?
和
如何重新安装易用的软件?
推荐答案
您尝试像这样使用sudo
吗?
sudo easy_install requests
或将安装目录指定为您具有写权限的目录.
Or specify the install directory to a directory that you have write privileges.
easy_install --install-dir=/home/foo/bar
但是您应该真正使用 PIP 而不是easy_install
.它要好得多,并具有更多功能.
But you should really use PIP instead of easy_install
. It is much better and has a lot more features.
这篇关于无法使用easy_install安装Python模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!