按照http://sfepy.org/doc-devel/installation.html#installing-sfepy 中的指示,我使用以下命令将 SfePy 安装到我的 Python 2.7 anaconda
conda 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.
Run Code Online (Sandbox Code Playgroud)
我看到消息的最后包含了一些建议:
解决此问题的一种方法是反复卸载 numpy 直到找不到为止,然后重新安装此版本。
问题):
conda remove --force
但这对我来说听起来很可怕。conda install -c conda-forge sfepy
再次重新安装一个好的 numpy?当您使用 pip 安装时,通常会反复卸载 numpy。因为您使用的是 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 activate finite