问题
I just did a fresh/clean install of Python 2.7.9 to get pip (couldn't get it any other way) and now when I go to install something using it I get this error:
pip install openpyxl
Downloading/unpacking openpyxl
Cannot fetch index base URL https://pypi.python.org/simple
Could not find any downloads that satisfy the requirement openpyxl
Cleaning up...
No distributions at all found for openpyxl
Storing debug log for failure in C:\Users\name\pip\pip.log
The error log looks similar, just many time out messages with no more information:
Downloading/unpacking openpyxl
Getting page https://pypi.python.org/simple/openpyxl/
Could not fetch URL https://pypi.python.org/simple/openpyxl/: timed out
Will skip URL https://pypi.python.org/simple/openpyxl/ when looking for download links for openpyxl
Getting page https://pypi.python.org/simple/
Could not fetch URL https://pypi.python.org/simple/: timed out
Will skip URL https://pypi.python.org/simple/ when looking for download links for openpyxl
Cannot fetch index base URL https://pypi.python.org/simple/
URLs to search for versions for openpyxl:
* https://pypi.python.org/simple/openpyxl/
Getting page https://pypi.python.org/simple/openpyxl/
Could not fetch URL https://pypi.python.org/simple/openpyxl/: timed out
Will skip URL https://pypi.python.org/simple/openpyxl/ when looking for download links for openpyxl
Could not find any downloads that satisfy the requirement openpyxl
Cleaning up...
Removing temporary dir c:\users\dqa8300\appdata\local\temp\pip_build_DQA8300...
No distributions at all found for openpyxl
Exception information:
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\pip\basecommand.py", line 122, in main
status = self.run(options, args)
File "C:\Python27\lib\site-packages\pip\commands\install.py", line 278, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "C:\Python27\lib\site-packages\pip\req.py", line 1177, in prepare_files
url = finder.find_requirement(req_to_install, upgrade=self.upgrade)
File "C:\Python27\lib\site-packages\pip\index.py", line 277, in find_requirement
raise DistributionNotFound('No distributions at all found for %s' % req)
DistributionNotFound: No distributions at all found for openpyxl
I'm assuming that this is a network thing, is there any work around?
回答1:
It seems like a network problem.
If you can open https://pypi.python.org/simple/openpyxl/ in your browser, then it may be some other issue.
回答2:
It appears you are behind a firewall on your corporate campus and need a proxy to make HTTP requests outside your local network. You will need to specify your proxy server in your shell before running pip
:
SET HTTPS_PROXY=<proxyHost>:<proxyPort>
SET HTTP_PROXY=<proxyHost>:<proxyPort>
You can also specify a proxy directly to pip
, but I understand this feature was broken at one point:
pip install <package> --proxy=<proxyHost>:<proxyPort>
However, we cannot determine your proxy information, you will need to do that. You may have some luck with:
import urllib2
print urllib2.getproxies()
来源:https://stackoverflow.com/questions/29267024/pip-unable-to-access-websites-fresh-install-of-python-2-7-9