python - 如何在 MacOS 上正确卸载 numpy?

标签 python macos python-2.7 numpy

我在 Mac 上,按顺序安装了 numpysklearn。现在,我面临着在 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..gives 权限错误

...OSError: [Errno 1] Operation not allowed: '/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

....但即使这样也给了我一个权限错误。是什么赋予了?

最佳答案

我猜你正在使用 MAC OS。 我做了一个解决方法来忽略 numpy 的现有版本(MAC 不会让你卸载),并安装升级版本。

命令:

pip install --upgrade --ignore-installed --install-option '--install-data=/usr/local' numpy

对我来说工作得很好。

关于python - 如何在 MacOS 上正确卸载 numpy?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39187374/

相关文章:

python - 如何通过pyspark以gzip格式保存spark RDD

mysql - 从命令行循环运行 SQL 查询

objective-c - 如何从 NSAlert 按钮上获取焦点环?

cocoa - 当 NSWindow 失去焦点时以编程方式关闭它

python - 我如何编写一个程序来单击Python中的特定链接

python-2.7 - 在 AWS Lambda 函数中使用 boto3 通过 AWS SNS 发送短信?

python时间模块: daylight savings

python - 试图理解 __init__.py 结合 getattr

python - 忽略 pandas DataFrame 中的行

python - 未找到命名游标的模块