python3.5安装numpy_现在,在Python 2.7中安装NumPy + SciPy会失败,并显示“ RuntimeError:Python版本> = 3.5必需”。...

1586010002-jmsa.png

Installing numpy and scipy from source like this (say, in a fresh Python 2.7 pyenv virtualenv):

pip install numpy==1.14.6 scipy==1.0.1 --no-binary numpy,scipy

gets their installers to use a ~/.numpy-site.cfg file that points to my openblas installation.

This used to work. Now it produces a long stack trace ending with:

File "/usr/local/var/pyenv/versions/2.7.16/envs/issue/lib/python2.7/site-packages/setuptools/sandbox.py", line 45, in _execfile

exec(code, globals, locals)

File "/var/folders/_b/q30qg_l50b5gvqd8y4_wb9h00000gn/T/easy_install-o9MJ5E/numpy-1.17.1/setup.py", line 31, in

if sys.version_info[0] < 3:

RuntimeError: Python version >= 3.5 required.

----------------------------------------

ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Q. What changed?

Q. Why does it say Python version >= 3.5 required. in a Python 2.7 installation?

Q. How to fix it?

解决方案

The scipy 1.0.1 installer requires numpy as a prerequisite, but the multiple installers working together end up getting the latest version of numpy unless numpy is already present.

What changed: The latest version of numpy requires Python 3.5+, hence the error message.

So even though the pip command explicitly asked to install numpy==1.14.6 scipy==1.0.1, it triggers a newer numpy installer that fails on Python 2. (The last entry in the stack trace shows numpy-1.17.1 requiring Python 3.)

The problem arises in the interaction between pip, the scipy and numpy installers, and easy_install. Details in pip issue #6945.

Workaround: Install numpy first. Then install scipy. Alternatively, the one-line install might work if you don't need the --no-binary option.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值