Невозможно использовать easy_install для установки модулей Python

Я пытаюсь использовать easy_install для установки модуля под названием requests, выполнив

easy_install requests

Это работало нормально неделю назад, когда я использовал Python 2.6.5, но сегодня я установил Python 2.7.2 и затем попытался импортировать requests в один из моих скриптов, но это не удалось. Затем я попытался переустановить requests с помощью easy_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, и я пошел на http://pypi.python.org/pypi/setuptools и узнал, что мне нужно

удалить все файлы setuptools*.egg и setuptools.pth из вашей директории site-packages. системного каталога site-packages (и любых других каталогов sys.path) ПЕРВОЕ.

Так я и сделал. Затем я переустановил setuptools из setuptools-0.6c11-py2.7.egg. Все прошло успешно, но когда я запустил easy_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_install и нажимаю tab, я получаю эти опции

easy_install      easy_install-2.6  easy_install-2.7

Почему easy_install-2.6 здесь?

и

Как мне заставить easy-install снова работать?

14
задан Classer 1 October 2011 в 19:52
поделиться