安装 Python 请求 [英] Installing Python Requests
本文介绍了安装 Python 请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
所以我正在尝试使用 pip 下载请求,但出现以下错误.我已经检查了错误日志,但对我来说基本上无法理解.
So I'm trying to download requests using pip and am getting the error below. I've checked the error log but it's largely incomprehensible to me.
有什么建议吗?尝试将 pip 用于 beautifulsoup4 时,我遇到了类似的问题.
Any suggestions? I'm getting a similar issue when trying to use pip for beautifulsoup4.
~ ∴ pip install requests
Downloading/unpacking requests
Downloading requests-2.2.1-py2.py3-none-any.whl (625kB): 625kB downloaded
Installing collected packages: requests
Cleaning up...
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip-1.5.2-py2.7.egg/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip-1.5.2-py2.7.egg/pip/commands/install.py", line 279, in run
requirement_set.install(install_options, global_options, root=options.root_path)
File "/Library/Python/2.7/site-packages/pip-1.5.2-py2.7.egg/pip/req.py", line 1380, in install
requirement.install(install_options, global_options, *args, **kwargs)
File "/Library/Python/2.7/site-packages/pip-1.5.2-py2.7.egg/pip/req.py", line 664, in install
self.move_wheel_files(self.source_dir, root=root)
File "/Library/Python/2.7/site-packages/pip-1.5.2-py2.7.egg/pip/req.py", line 894, in move_wheel_files
pycompile=self.pycompile,
File "/Library/Python/2.7/site-packages/pip-1.5.2-py2.7.egg/pip/wheel.py", line 202, in move_wheel_files
clobber(source, lib_dir, True)
File "/Library/Python/2.7/site-packages/pip-1.5.2-py2.7.egg/pip/wheel.py", line 189, in clobber
os.makedirs(destsubdir)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/requests'
Storing debug log for failure in /Users/my_name/Library/Logs/pip.log
推荐答案
您正在尝试将软件包安装在/Library/Python/2.7/site-packages/requests"中,但它需要 root 权限才能这样做.这应该可以解决问题:
You are trying to install the package in '/Library/Python/2.7/site-packages/requests' but it requires root permissions to do so. This should do the trick:
$ sudo pip install requests
这篇关于安装 Python 请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文