【发布时间】:2022-12-05 05:13:32
【问题描述】:
如图所示,我安装了 numpy。我正在使用 M1 芯片的说明
https://developer.apple.com/metal/tensorflow-plugin/
(base) cody@Codys-MBP ~ % pip install numpy --upgrade --force-reinstall
Defaulting to user installation because normal site-packages is not writeable
Collecting numpy
Using cached numpy-1.23.5-cp39-cp39-macosx_11_0_arm64.whl (13.4 MB)
Installing collected packages: numpy
Attempting uninstall: numpy
Found existing installation: numpy 1.23.5
Uninstalling numpy-1.23.5:
Successfully uninstalled numpy-1.23.5
WARNING: The scripts f2py, f2py3 and f2py3.9 are installed in '/Users/cody/Library/Python/3.9/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed numpy-1.23.5
(base) cody@Codys-MBP ~ % python3 -c "import tensorflow as tf;"
RuntimeError: module compiled against API version 0x10 but this version of numpy is 0xf
RuntimeError: module compiled against API version 0x10 but this version of numpy is 0xf
ImportError: numpy.core._multiarray_umath failed to import
ImportError: numpy.core.umath failed to import
【问题讨论】:
-
可能是因为您安装的 NumPy 版本与您使用的 TensorFlow 版本不兼容。尝试使用以下命令卸载并重新安装 TensorFlow 和 NumPy
pip uninstall tensorflow numpy然后是pip install tensorflow numpy。 -
删除整个 miniconda 目录并再次按照说明进行操作。不要手动安装 Numpy。
标签: python tensorflow