在ubuntu上下载python错误请求

2024-03-29 02:24:33 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在我的电脑上运行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

有人对如何克服或解决这个问题有什么建议吗?你知道吗


Tags: installpiptxtubuntulibpackagesusrlocal
1条回答
网友
1楼 · 发布于 2024-03-29 02:24:33

你的错误

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。你知道吗

相关问题 更多 >