gpt4 book ai didi

python - Anaconda Python - 如何重新安装 NumPy

转载 作者:太空狗 更新时间:2023-10-29 17:06:12 26 4
gpt4 key购买 nike

我在 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.

看来我需要“重新安装”NumPy。我在网上搜索,但没有找到“重新安装”的方法。只有如何“安装”,以及何时使用

conda install numpy

在 Anaconda Prompt 中我得到:

Solving environment: done

# All requested packages already installed.

如果我尝试删除 NumPy 以再次安装它,它将删除所有内容,而不仅仅是 NumPy。那么我真的需要“重新安装”NumPy 才能导入 sklearn 吗?如果我这样做,我该如何“重新安装”NumPy?

最佳答案

如何重新安装包取决于 conda 版本。

newer versions (>= 4.6):

conda install numpy --force-reinstall

旧版本(< 4.6):

conda install numpy --force

关于python - Anaconda Python - 如何重新安装 NumPy,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52792692/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com