我在尝试使用pip安装模块时遇到SSL错误,我在网上浏览了一下并找到了解决该问题的常用解决方案:
C:\Python35>pip3 install --index-url=http://pypi.python.org/simple/ --trusted-host pypi.python.org sphinx
然而,运行此命令并不像我想的那样工作。我做错了什么?
C:\Python35>pip3 install --index-url=http://pypi.python.org/simple/ --trusted-host pypi.python.org -vvv sphinx
Config variable 'Py_DEBUG' is unset, Python ABI tag may be incorrect
Config variable 'WITH_PYMALLOC' is unset, Python ABI tag may be incorrect
Collecting sphinx
1 location(s) to search for versions of sphinx:
* http://pypi.python.org/simple/sphinx/
Getting page http://pypi.python.org/simple/sphinx/
Starting new HTTP connection (1): pypi.python.org
"GET /simple/sphinx/ HTTP/1.1" 403 16
Could not fetch URL http://pypi.python.org/simple/sphinx/: 403 Client Error: SSL is required for url: http://pypi.python.org/simple/sphinx/ - skipping
Could not find a version that satisfies the requirement sphinx (from versions: )
Cleaning up...
No matching distribution found for sphinx
Exception information:
Traceback (most recent call last):
File "C:\python35\lib\site-packages\pip\basecommand.py", line 215, in main
status = self.run(options, args)
File "C:\python35\lib\site-packages\pip\commands\install.py", line 324, in run
requirement_set.prepare_files(finder)
File "C:\python35\lib\site-packages\pip\req\req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "C:\python35\lib\site-packages\pip\req\req_set.py", line 554, in _prepare_file
require_hashes
File "C:\python35\lib\site-packages\pip\req\req_install.py", line 278, in populate_link
self.link = finder.find_requirement(self, upgrade)
File "C:\python35\lib\site-packages\pip\index.py", line 514, in find_requirement
'No matching distribution found for %s' % req
pip.exceptions.DistributionNotFound: No matching distribution found for sphinx
问候
修改 正如Mukul Sharma使用
写的那样C:\ Python35> pip3 install --index-url = https :// pypi.python.org/simple/ --trusted-host pypi.python.org -vvv sphinx
而是解决了我的问题。
答案 0 :(得分:2)
Python停止了对来自http的请求的支持,他们只允许通过https发出请求。您可以阅读有关here的更多信息。
只需使用https而不是http
C:\Python35>pip3 install --index-url=https://pypi.python.org/simple/ --trusted-host pypi.python.org sphinx