電腦上已經(jīng)安裝了cvxpy庫,但是導(dǎo)入的時候出現(xiàn)如下錯誤提示
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
發(fā)現(xiàn)出現(xiàn)上面的錯誤提示后,更新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
但是沒有關(guān)系,如果你不用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
然后再執(zhí)行import cvxpy庫就沒有錯誤提示了。








暫無數(shù)據(jù)