Подтвердить что ты не робот

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

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

easy_install requests

Это отлично работало неделю назад, когда я использовал Python 2.6.5, но сегодня я установил Python 2.7.2, а затем попытался import 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 из вашего system site-packages (и любые другие каталоги sys.path) FIRST.

Итак, я сделал это. Затем я переустановил setuptools из setuptools-0.6c11-py2.7.egg. Он казался успешным, но когда я побежал easy_install requests, я получил в основном ту же ошибку, кроме каталога python2.6/dist-packages теперь python2.7/site-packages

[email protected]:~$ 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 и нажимаю вкладку, я получаю эти параметры

easy_install      easy_install-2.6  easy_install-2.7

Как выглядит easy_install-2.6?

и

Как я могу упростить работу снова?

4b9b3361

Ответ 1

Вы пытались использовать sudo следующим образом?

sudo easy_install requests

Или укажите каталог установки в каталог, в котором есть права на запись.

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

Но вы действительно должны использовать PIP вместо easy_install. Это намного лучше и имеет намного больше возможностей.

Ответ 2

Вы должны использовать virtualenv в дистрибутивах на основе пакетов, поэтому скрипты Python не мешают другим пакетам или конфликтуют с диспетчером пакетов ОС.

http://workaround.org/easy-install-debian

Ответ 3

Следующее работало для меня с Ubuntu 12.10, устанавливая easy_install, затем pip:

sudo apt-get install python-virtualenv
curl -O https://raw.github.com/pypa/pip/master/contrib/get-pip.py
sudo python get-pip.py

Ответ 4

Вы пытались добавить свой новый python.framework в путь? На горном льве я добавил /Library/Frameworks/Python.framework/Versions/3.3/bin/ в /etc/paths а затем я смог использовать easy_install-3.3 и pip-3.3

Ответ 5

Это может быть простой случай, когда вы пропускаете "sudo" спереди. Можете ли вы попробовать с помощью запросов sudo easy-install

установка "sudo" добавит требуемые разрешения.

Ответ 6

Использование Sudo до easy_install может решить вашу проблему

Sudo easy_install requests

спасибо