对于 python 3.8.8 并在 jupyter 笔记本和 python 终端中使用新的 mac air(带有 m1 芯片),import jax
会引发此错误
Python 3.8.8 (default, Apr 13 2021, 12:59:45)
[Clang 10.0.0 ] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import jax
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/steve/Documents/code/jax/jax/__init__.py", line 37, in <module>
from . import config as _config_module
File "/Users/steve/Documents/code/jax/jax/config.py", line 18, in <module>
from jax._src.config import config
File "/Users/steve/Documents/code/jax/jax/_src/config.py", line 26, in <module>
from jax import lib
File "/Users/steve/Documents/code/jax/jax/lib/__init__.py", line 63, in <module>
cpu_feature_guard.check_cpu_features()
RuntimeError: This version of jaxlib was built using AVX instructions, which your CPU and/or operating system do not support. You may be able work around this issue by building jaxlib from source.
我怀疑它是因为 m1 芯片而发生的。
我尝试使用 jax pip install jax
,然后按照评论的建议,通过克隆他们的存储库并按照此处给出的说明从源代码构建它,但显示相同的错误消息。