Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
603 views
in Technique[技术] by (71.8m points)

python - Unable to install any package through pip

For some reason I have issues installing new packages with my pip. I have an OS Sierra environment and everything was working fine before. Now either I use a virtualenv or not, I get:

Collecting requests
Could not find a version that satisfies the requirement requests (from 
  versions: )
No matching distribution found for requests

This is not only for the "requests" library but also for all the others (e.g. django etc.).

I have the latest pip:

 pip --version
 returns: pip 9.0.1 from /Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg (python 2.7)

And my python version is: 2.7.12

Moreover based on this article I checked if I can curl the PyPi website and I do get a response back.

Any idea what is wrong?

EDITED

I executed the pip install as:

pip install -vvv requests

and I get a detailed output of the error:

Collecting requests
  2 location(s) to search for versions of requests:
  * http://pypi.python.org/simple/requests/
  * http://pypi.wfp.org/simple/requests/
  Getting page http://pypi.python.org/simple/requests/
  Starting new HTTP connection (1): pypi.python.org
  "GET /simple/requests/ HTTP/1.1" 403 16
  Could not fetch URL http://pypi.python.org/simple/requests/: 403 Client 
  Error: SSL is required for url: http://pypi.python.org/simple/requests/ - 
  skipping
  Getting page http://pypi.wfp.org/simple/requests/
  Starting new HTTP connection (1): pypi.wfp.org
  "GET /simple/requests/ HTTP/1.1" 404 None
  Could not fetch URL http://pypi.wfp.org/simple/requests/: 404 Client 
  Error: NOT FOUND for url: http://pypi.wfp.org/simple/requests/ - skipping
  Could not find a version that satisfies the requirement requests (from 
  versions: )
 Cleaning up...
  No matching distribution found for requests
 Exception information:
 Traceback (most recent call last):
 File "/Library/Python/2.7/site-packages/pip-9.0.1-
py2.7.egg/pip/basecommand.py", line 215, in main
  status = self.run(options, args)
 File "/Library/Python/2.7/site-packages/pip-9.0.1-
py2.7.egg/pip/commands/install.py", line 324, in run
requirement_set.prepare_files(finder)
File "/Library/Python/2.7/site-packages/pip-9.0.1-
py2.7.egg/pip/req/req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "/Library/Python/2.7/site-packages/pip-9.0.1-
py2.7.egg/pip/req/req_set.py", line 554, in _prepare_file
require_hashes
File "/Library/Python/2.7/site-packages/pip-9.0.1-
py2.7.egg/pip/req/req_install.py", line 278, in populate_link
self.link = finder.find_requirement(self, upgrade)
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/index.py", 
line 514, in find_requirement
'No matching distribution found for %s' % req
DistributionNotFound: No matching distribution found for requests
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The solution proposed by user1919 helped me to resolve installation of tox on lxc ubuntu container as the defualt pip version 8 doesn't recognize the correct url

I used:

pip install -v tox -i https://pypi.python.org/simple/
....
....
....
Successfully installed filelock-3.0.10 pluggy-0.9.0 py-1.8.0 setuptools-40.8.0 toml-0.10.0 tox-3.7.0 virtualenv-16.4.3

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...