【发布时间】:2017-01-04 08:53:35
【问题描述】:
我在 Mac 上,按顺序安装了 numpy 和 sklearn。现在,我面临着在 SO 上多次提到的这些错误:
sklearn "numpy.dtype has the wrong size, try recompiling" in both pycharm and terminal
ValueError: numpy.dtype has the wrong size, try recompiling
ImportError in importing from sklearn: cannot import name check_build
因此,我尝试通过卸载 numpy 并重新安装以前的版本来纠正此错误。
1) sudo pip install --upgrade numpy..给出权限错误
...OSError: [Errno 1] Operation not permitted: '/tmp/pip-OVY0Vq-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy-1.8.0rc1-py2.7.egg-info'...
2) 我尝试了brew uninstall numpy,但import numpy 即使在 shell 重新启动后仍然有效。
我唯一能想到的就是手动删除所有numpy 文件,这些文件在 Mac 上似乎位于
sudo rm -rf /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy
....但即使这样也给了我一个权限错误。是什么赋予了?
【问题讨论】:
-
我可能会手动删除文件,然后为了避免错误和可能损坏您的操作系统,您应该在虚拟环境中安装您的软件包。例如docs.python-guide.org/en/latest/dev/virtualenvs
-
但是,这些是要删除的正确文件吗?
-
即使使用
sudo.....它也不会让我删除它们!!建议?? -
好的,我试试
sudo chmod 777 /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy,我得到chmod: Unable to change file mode on /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy: Operation not permitted。什么给了? -
只有我一个人认为这不应该那么难!!!??
标签: python macos python-2.7 numpy