我没有成功在mac OS X中使用pip2.7安装任何东西

时间:2015-03-16 13:28:53

标签: python macos pip

标题中已经说了所有内容。我已经花了几个小时阅读并尝试解决没有成功的问题,这就是我现在在这里问的原因。

$ pip2.7 install numpy
Downloading/unpacking numpy
  Cannot fetch index base URL https://pypi.python.org/simple/
  Could not find any downloads that satisfy the requirement numpy
Cleaning up...
No distributions at all found for numpy
Storing debug log for failure in /Users/servoz/.pip/pip.log

[servoz@irmu06]:~ $ more /Users/servoz/.pip/pip.log
Downloading/unpacking numpy
  Getting page https://pypi.python.org/simple/numpy/
  Could not fetch URL https://pypi.python.org/simple/numpy/: timed out
  Will skip URL https://pypi.python.org/simple/numpy/ when looking for download links for numpy
  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 numpy
  Cannot fetch index base URL https://pypi.python.org/simple/
  URLs to search for versions for numpy:
  * https://pypi.python.org/simple/numpy/
  Getting page https://pypi.python.org/simple/numpy/
  Could not fetch URL https://pypi.python.org/simple/numpy/: timed out
  Will skip URL https://pypi.python.org/simple/numpy/ when looking for download links for numpy
  Could not find any downloads that satisfy the requirement numpy
Cleaning up...
  Removing temporary dir /private/var/folders/H8/H8pQdhk6FqiNDBM7G4Q13k++-KY/-Tmp-/pip_build_econdami...
No distributions at all found for numpy
Exception information:
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/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 "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/req.py", line 1177, in prepare_files
    url = finder.find_requirement(req_to_install, upgrade=self.upgrade)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/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 numpy

问题似乎不是来自与pypi.python.org的联系:

$ ping pypi.python.org
PING python.map.fastly.net (185.31.17.223): 56 data bytes
64 bytes from 185.31.17.223: icmp_seq=0 ttl=51 time=27.198 ms
64 bytes from 185.31.17.223: icmp_seq=1 ttl=49 time=27.130 ms
64 bytes from 185.31.17.223: icmp_seq=2 ttl=51 time=27.144 ms
64 bytes from 185.31.17.223: icmp_seq=3 ttl=49 time=27.237 ms
64 bytes from 185.31.17.223: icmp_seq=4 ttl=49 time=27.126 ms
64 bytes from 185.31.17.223: icmp_seq=5 ttl=49 time=27.100 ms
64 bytes from 185.31.17.223: icmp_seq=6 ttl=51 time=27.092 ms
64 bytes from 185.31.17.223: icmp_seq=7 ttl=49 time=27.185 ms
^C
--- python.map.fastly.net ping statistics ---
8 packets transmitted, 8 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 27.092/27.151/27.237/0.047 ms

它适用于linux,我承认我不太了解mac OS X. 任何建议将非常感谢! 提前谢谢你!

1 个答案:

答案 0 :(得分:0)

好的我明白了,

事实上,问题来自代理(感谢Paul Bissex给了我一个好主意,用curl -I pypi.python.org/simple/numpy检查连接)。 所以我在/ etc / profile中添加了这两行(允许所有人):

export http_proxy=http://server-ip:port/
export https_proxy=http://server-ip:port/

参见例如:http://www.cyberciti.biz/faq/linux-unix-set-proxy-environment-variable/

现在连接问题已解决:

$ curl -I https://pypi.python.org/simple/numpy/
HTTP/1.1 200 Connection established

HTTP/1.1 200 OK
Date: Tue, 17 Mar 2015 11:18:19 GMT
Server: nginx/1.6.2
Content-Type: text/html; charset=utf-8
X-PYPI-LAST-SERIAL: 1443843
Cache-Control: max-age=600, public
Strict-Transport-Security: max-age=31536000; includeSubDomains
Public-Key-Pins: max-age=600; includeSubDomains; pin-sha256="WoiWRyIOVNa9ihaBciRSC7XHjliYS9VwUGOIud4PB18="; pin-sha256="5C8kvU039KouVrl52D0eZSGf4Onjo4Khs8tmyTlV3nU="; pin-sha256="5C8kvU039KouVrl52D0eZSGf4Onjo4Khs8tmyTlV3nU="; pin-sha256="lCppFqbkrlJ3EcVFAkeip0+44VaoJUymbnOaEUk7tEU="; pin-sha256="TUDnr0MEoJ3of7+YliBMBVFB4/gJsv5zO7IxD9+YoWI="; pin-sha256="x4QzPSC810K5/cMjb05Qm4k3Bw5zBn4lTdO/nEW/Td4=";
Via: 1.1 varnish
Content-Length: 15747
Accept-Ranges: bytes
Via: 1.1 varnish
Age: 51777
X-Served-By: cache-iad2134-IAD, cache-fra1220-FRA
X-Cache: HIT, HIT
X-Cache-Hits: 1, 17
X-Timer: S1426591099.867129,VS0,VE0
Vary: Accept-Encoding

$ pip2.7 install numpy
Downloading/unpacking numpy
Downloading numpy-1.9.2-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 (3.7MB) downloaded
Installing collected packages: numpy
Successfully installed numpy
Cleaning up...

感谢所有人的帮助。