我正在努力让AI健身房工作,但我面临一个非常持久的错误 当我运行我的程序(只是简单的演示cartpole解算器)时,我得到了这个错误。 (文件“gperm.py”是cartpole求解器)
File "gperm.py", line 1, in <module>
import gym
File "/Users/sonyaferraro/Desktop/dpy/gym/__init__.py", line 48, in <module>
sanity_check_dependencies()
File "/Users/sonyaferraro/Desktop/dpy/gym/__init__.py", line 20, in sanity_check_dependencies
if distutils.version.LooseVersion(numpy.__version__) < distutils.version.LooseVersion('1.10.4'):
最后打印:
AttributeError: module 'numpy' has no attribute '__version__'
这很奇怪,因为我做了numpy的完整pip安装,甚至尝试git克隆它既不起作用。我已经检查过以确保我没有其他名为numpy的文件,所有内容似乎都在检查中。
如果其他人遇到同样的问题,或者任何人都有解决方案,我们将不胜感激。
它还会打印一个“提示”,提示我尝试:pip install -U numpy。
logger.warn("You have 'numpy' version %s installed, but 'gym' requires at least 1.10.4. HINT: upgrade via 'pip install -U numpy'.", numpy.__version__)
我确实有一个numpy&gt; = 1.10.4的版本,所以不应该弹出正确的?(不记得确切的版本)
使用pip install -U numpy会返回'SNIMissingWarning','InsequrePlatformWarning'以及以下内容:
The directory '/Users/sonyaferraro/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/sonyaferraro/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
老实说,我不知道是什么告诉我这样做,因为我对这些目录有权限。
答案 0 :(得分:2)
根据您的终端输出,我认为您正在使用带有Brew的MacOS。
brew link --overwrite numpy
似乎已经为我解决了这个问题。