gpt4 book ai didi

python - pip 安装失败,出现 : OSError: [Errno 13] Permission denied on directory

转载 作者:IT老高 更新时间:2023-10-28 21:06:20 31 4
gpt4 key购买 nike

pip install -r requirements.txt 失败,出现以下异常 OSError: [Errno 13] Permission denied: '/usr/local/lib/...。出了什么问题,我该如何解决? (我正在尝试设置 Django )

Installing collected packages: amqp, anyjson, arrow, beautifulsoup4, billiard, boto, braintree, celery, cffi, cryptography, Django, django-bower, django-braces, django-celery, django-crispy-forms, django-debug-toolbar, django-disqus, django-embed-video, django-filter, django-merchant, django-pagination, django-payments, django-storages, django-vote, django-wysiwyg-redactor, easy-thumbnails, enum34, gnureadline, idna, ipaddress, ipython, kombu, mock, names, ndg-httpsclient, Pillow, pyasn1, pycparser, pycrypto, PyJWT, pyOpenSSL, python-dateutil, pytz, requests, six, sqlparse, stripe, suds-jurko
Cleaning up...
Exception:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 283, in run
requirement_set.install(install_options, global_options, root=options.root_path)
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1436, in install
requirement.install(install_options, global_options, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 672, in install
self.move_wheel_files(self.source_dir, root=root)
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 902, in move_wheel_files
pycompile=self.pycompile,
File "/usr/lib/python2.7/dist-packages/pip/wheel.py", line 206, in move_wheel_files
clobber(source, lib_dir, True)
File "/usr/lib/python2.7/dist-packages/pip/wheel.py", line 193, in clobber
os.makedirs(destsubdir)
File "/usr/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/amqp-1.4.6.dist-info'

最佳答案

sudopip install 一起使用,不如先尝试 pip install --user。如果失败,请查看顶部帖子 here .

你不应该使用 sudo 的原因如下:

当你使用 sudo 运行 pip 时,你正在以 root 用户身份运行来自 Internet 的任意 Python 代码,这是一个相当大的安全风险。如果有人在 PyPI 上放置了一个恶意项目并且你安装了它,你就给了攻击者对你机器的 root 访问权限。

关于python - pip 安装失败,出现 : OSError: [Errno 13] Permission denied on directory,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31512422/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com