繁体   English   中英

无法在 Python3、Ubuntu14.04 中使用 pip 安装 NumPy

[英]Can not install NumPy using pip in Python3, Ubuntu14.04

尝试 pip install NumPy 时出现此错误:

pip 配置了需要 TLS/SSL 的位置,但是 Python 中的 ssl 模块不可用。

Collecting numpy

Could not fetch URL https://pypi.python.org/simple/numpy/: There was a problem confirming the ssl certificate: 

Can't connect to HTTPS URL because the SSL module is not available. - skipping
  Could not find a version that satisfies the requirement numpy (from versions: )
No matching distribution found for numpy

有谁知道如何解决这个问题?

您可能会遇到一两个问题:

首先,您需要使用以下命令安装 OpenSSL:

sudo apt-get install openssl

其次确保您的python 版本针对SSL 编译。 我相信您安装了预编译版本。 在这种情况下,它会很好。 否则,您还需要在构建 python 之前安装 libssl-dev

解决方案 1 :也许尝试使用sudo -E

 -E          The -E (preserve environment) option indicates to the secu‐
             rity policy that the user wishes to preserve their existing
             environment variables.  The security policy may return an
             error if the -E option is specified and the user does not
             have permission to preserve the environment.

解决方案 2 :代理可能会对此产生影响。 所以:

sudo pip --proxy=http://username:password@proxyURL:portNumber install your-package

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM