热线电话:13121318867

登录
2021-04-15 阅读量: 14003
python导入库的时候有错误提示module compiled against API version 0xe but this version of numpy is 0xd

电脑上已经安装了cvxpy库,但是导入的时候出现如下错误提示

import cvxpy

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

RuntimeError Traceback (most recent call last)

RuntimeError: module compiled against API version 0xe but this version of numpy is 0xd


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

ImportError Traceback (most recent call last)



D:\ProgramData\Anaconda3\lib\site-packages\cvxpy\cvxcore\python\__init__.py in <module>

1 # TODO(akshayka): This is a hack; the swig-auto-generated cvxcore.py

2 # tries to import cvxcore as `from . import _cvxcore`

----> 3 import _cvxcore


ImportError: numpy.core.multiarray failed to import


发现出现上面的错误提示后,更新numpy库就可以了

(base) C:\Users\Administrator>pip install numpy --upgrade -i https://pypi.douban.com/simple --use-feature=2020-resolver

虽然安装过程中会提醒我们升级完了numpy库版本到1.20.2的时候就与tensorflow冲突了。 2.4.1 requires numpy~=1.19.2

但是没有关系,如果你不用tensorflow是没事的。

Uninstalling numpy-1.19.5:

Successfully uninstalled numpy-1.19.5

ERROR: After October 2020 you may experience errors when installing or updating

packages. This is because pip will change the way that it resolves dependency co

nflicts.


We recommend you use --use-feature=2020-resolver to test your packages with the

new resolver before it becomes the default.


tensorflow 2.4.1 requires numpy~=1.19.2, but you'll have numpy 1.20.2 which is i

ncompatible.

Successfully installed numpy-1.20.2




然后再执行import cvxpy库就没有错误提示了。

0.png

0.0000
0
关注作者
收藏
评论(0)

发表评论

暂无数据
推荐帖子