在ubuntu上下载python错误的请求

时间:2014-05-13 03:38:58

标签: python python-2.7 terminal ubuntu-12.04 python-requests

我正在计算机上运行ubuntu而我正在尝试下载requests

但是,当我pip install requests时,它会给我一个错误:

writing manifest file 'requests.egg-info/SOURCES.txt'

running install_lib

creating /usr/local/lib/python2.7/dist-packages/requests

error: could not create '/usr/local/lib/python2.7/dist-packages/requests': Permission denied

----------------------------------------
Command /usr/bin/python -c "import setuptools;__file__='/home/alejandro/build/requests/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-tT3Boe-record/install-record.txt failed with error code 1

有没有人知道如何解决这个问题或修复它?

1 个答案:

答案 0 :(得分:1)

您的错误

could not create '/usr/local/lib/python2.7/dist-packages/requests': Permission denied

建议您尝试以普通用户的身份安装系统级用户 - 您无权这样做。

您可以使用--user选项为自己安装软件包:

pip install --user requests

...或使用sudo以root身份在系统范围内安装:

sudo pip install requests

或者,您可以考虑使用virtual environment