按照 http://sfepy.org/doc-devel/installation.html#installing-sfepy 中的说明进行操作我使用
将 SfePy 安装到我的 Python 2.7 anacondaconda install -c conda-forge sfepy
在那之后,我不能再导入 numpy
>>> import numpy as np
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/david/anaconda2/lib/python2.7/site-packages/numpy/__init__.py", line 142, in <module>
from . import core
File "/Users/david/anaconda2/lib/python2.7/site-packages/numpy/core/__init__.py", line 91, in <module>
raise ImportError(msg.format(path))
ImportError: Something is wrong with the numpy installation. While importing we
detected an older version of numpy in ['/Users/david/anaconda2/lib/python2.7/site-packages/numpy']. One method of fixing this is to repeatedly uninstall numpy until none is found, then reinstall this version.
我看到消息的最后包含了一些建议:
One method of fixing this is to repeatedly uninstall numpy until none is found, then reinstall this version.
问题:
- 如何安全地“反复卸载 numpy”? This answer提到
conda remove --force
但这对我来说听起来很可怕。 - 一旦“找不到”,
conda install -c conda-forge sfepy
会再次重新安装一个好的 numpy 吗? - 为什么会发生这种情况?它可能反射(reflect)了一些潜在的严重问题,还是只是“其中之一”,我应该“反复卸载 numpy”并继续我的生活?
最佳答案
反复卸载numpy一般是用pip安装的时候。因为您使用的是 Conda,所以尝试 conda uninstall numpy
将删除 numpy 和任何依赖于 numpy 的包(以及任何依赖于它们的包等)。
通常,这意味着您将破坏您的环境。使用 Conda 的全部意义在于创建新的隔离环境,这样您就不必担心遇到的问题:包冲突。
您应该采取的步骤是:
卸载 Anaconda,看起来您的基础安装可能已经很乏味了。另外,下车 PYTHON 2.7!
重新安装 Anaconda,最好使用 Python 3.6 或更高版本。
使用 conda 为您的工作创建一个隔离的环境。
conda create -n finite python=3.6 sfepy numpy pandas ipython
激活并使用该环境进行有限分析工作。
conda 激活有限
关于python - 我如何安全地使用 "repeatedly uninstall numpy"?为什么这是必要的?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55944472/