python卸载numpy,我如何“反复卸载numpy”?安全吗?为什么有这个必要?

Following directions in http://sfepy.org/doc-devel/installation.html#installing-sfepy I installed SfePy to my Python 2.7 anaconda using

conda install -c conda-forge sfepy

Immediately after that, I can no longer import numpy

>>> import numpy as np

Traceback (most recent call last):

File "", line 1, in

File "/Users/david/anaconda2/lib/python2.7/site-packages/numpy/__init__.py", line 142, in

from . import core

File "/Users/david/anaconda2/lib/python2.7/site-packages/numpy/core/__init__.py", line 91, in

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.

I see that there is some advice included at the very end of the message:

One method of fixing this is to repeatedly uninstall numpy until none is found, then reinstall this version.

Question(s):

How exactly do I "repeatedly uninstall numpy" safely? This answer mentions conda remove --force but that sounds scary to me.

Once "none is found" would conda install -c conda-forge sfepy again reinstall one good numpy?

Why might this have happened? Might it reflect some underlying serious problem, or is it just "one of those things" and I should just "repeatedly uninstall numpy" and move on with my life?

解决方案

Repeatedly uninstalling numpy would normally be for when you used pip to install. Because you are using Conda, trying to conda uninstall numpy will remove numpy and any package that depends on numpy (and any package that depends on those, etc).

Generally, this means you will break your environment. The whole point of using Conda is to create new, isolated environments so that you don't have to worry about what you are running into: package collision.

The steps you should take are:

Uninstall Anaconda, it looks like you may have borked your base installation. Also, GET OFF PYTHON 2.7!

Reinstall Anaconda, preferably with Python 3.6 or higher.

Use conda to create an isolated environment for you to work in.

conda create -n finite python=3.6 sfepy numpy pandas ipython

Activate and use that environment to do your work in finite analysis. conda activate finite

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值