Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

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

python - pip not installing modules

As per object. I'm running Python 2.7.10 under Windows 7 64 bit. I added C:Python27Scripts to my PATH, and I can run pip, but it's not able to install modules. For example

pip install numpy

gives

Collecting numpy
Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after
connection broken by 'ProtocolError('Connection aborted.', gaierror(11004,'getaddrinfo failed'))': /simple/numpy/

It keeps retrying and failing for a while, then it exits with

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

Probably I'm behind a firewall, but I'm quite disappointed because I can install packages under R perfectly fine with install.packages, and I don't see why I can't do the same with Python. If I install packages manually (in the case of numpy, from here

numpy

what do I miss, with respect to using pip?

EDIT: as per suggestions in the comments, I downloaded the .whl file for numpy from numpy, I navigated to the downloads dir and executed

  pip install numpy-1.10.1-cp27-none-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl

I only got

  numpy-1.10.1-cp27-none-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl is not a supported wheel on this platform.

What should I do?

See Question&Answers more detail:os

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

1 Reply

0 votes
by (71.8m points)

Proxy shall be used. For example:

python.exe -m pip install numpy --proxy="proxy.com:8080"

where "proxy.com:8080" is proxy server address and port. This can be found in OS settings.

How to get them:

  1. Windows: What Is a Proxy or Proxy Server
  2. Linux How can I find out the proxy address I am behind?
  3. OSX: How can I get Mac OS X's proxy information in a Bash script?

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...