Anaconda Python - 如何重新安装 NumPy
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/52792692/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Anaconda Python - how to reinstall NumPy
提问by Azzam Alsharafi
I am using Anaconda 5.3.0's Python interpreter in Visual Studio Code. When I try to import sklearn
I get an error:
我在 Visual Studio Code 中使用 Anaconda 5.3.0 的 Python 解释器。当我尝试导入时sklearn
出现错误:
Traceback (most recent call last):
File "c:\Users\azzam\machinelearning.py", line 1, in <module>
import sklearn
File "C:\Anaconda3\lib\site-packages\sklearn\__init__.py", line 134, in <module>
from .base import clone
File "C:\Anaconda3\lib\site-packages\sklearn\base.py", line 10, in <module>
import numpy as np
File "C:\Anaconda3\lib\site-packages\numpy\__init__.py", line 142, in <module>
from . import add_newdocs
File "C:\Anaconda3\lib\site-packages\numpy\add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "C:\Anaconda3\lib\site-packages\numpy\lib\__init__.py", line 8, in <module>
from .type_check import *
File "C:\Anaconda3\lib\site-packages\numpy\lib\type_check.py", line 11, in <module>
import numpy.core.numeric as _nx
File "C:\Anaconda3\lib\site-packages\numpy\core\__init__.py", line 26, in <module>
raise ImportError(msg)
ImportError:
Importing the multiarray numpy extension module failed. Most
likely you are trying to import a failed build of numpy.
If you're working with a numpy git repo, try `git clean -xdf` (removes all
files not under version control). Otherwise reinstall numpy.
Original error was: DLL load failed: The specified module could not be found.
It looks like that I need to "reinstall" NumPy. I searched on the web, but I didn't find a way to "reinstall". There is only how to "install", and when I use
看起来我需要“重新安装”NumPy。我在网上搜索,但我没有找到“重新安装”的方法。只有如何“安装”,当我使用
conda install numpy
in Anaconda Prompt I get:
在 Anaconda Prompt 我得到:
Solving environment: done
# All requested packages already installed.
And if I tried to remove NumPy to install it again, it will remove everything, not just NumPy. So do I really need to "reinstall" NumPy to be able to import sklearn
?
And if I do, how do I "reinstall" NumPy?
如果我尝试删除 NumPy 以重新安装它,它将删除所有内容,而不仅仅是 NumPy。那么我真的需要“重新安装” NumPy 才能导入sklearn
吗?如果我这样做了,我该如何“重新安装”NumPy?
回答by Hagne
How to reinstall a package depends on the conda version.
如何重新安装软件包取决于 conda 版本。
newer versions(>= 4.6):
较新的版本(>= 4.6):
conda install numpy --force-reinstall
older versions (< 4.6):
旧版本(< 4.6):
conda install numpy --force
回答by connectyourcharger
You will most likely have to uninstall NumPy and reinstall it.
您很可能必须卸载 NumPy 并重新安装它。
conda remove numpy
And then install it again:
然后再次安装:
conda install -c anaconda numpy
回答by Mwattad
go to your project setting and change the interrupter(i had the same problem and it solved like this)
转到您的项目设置并更改中断器(我遇到了同样的问题,它是这样解决的)