本文介绍了点不安装模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据对象.我正在Windows 7 64位下运行Python 2.7.10.我将C:\ Python27 \ Scripts添加到PATH,并且可以运行pip,但是它无法安装模块.例如

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

pip install numpy

给予

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

可能我在防火墙后面,但是我很失望,因为我可以在R下用install.packages完美安装软件包,而且我不明白为什么我不能用Python做同样的事情.如果我手动安装软件包(对于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

关于使用pip,我想念什么?

what do I miss, with respect to using pip?

根据评论中的建议,我从 numpy ,我导航到下载目录并执行

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

我只有

  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.

我该怎么办?

推荐答案

应使用代理.例如:

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

其中"proxy.com:8080"是代理服务器地址和端口.可以在操作系统设置中找到.

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

如何获取它们:

  1. Windows:什么是代理服务器或代理服务器
  2. Linux 如何查找掉我后面的代理地址?
  3. OSX:如何我可以在Bash脚本中获取Mac OS X的代理信息吗?
  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?

这篇关于点不安装模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-01 15:52