Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
234 views
in Technique[技术] by (71.8m points)

python - Importing the numpy c-extensions failed

Importing the numpy c-extensions failed

I installed python 3.7 on my windows system to work on visual studio code. Everything was going well, including using the libraries. I uninstalled python using the uninstalling program tool in control panel. And installed Miniconda 3. I checked that everything works well, and then installed the numpy library using conda install numpy in my terminal GitBash on windows 10, then checked it on my visial studio code, but it failed to start.

Reproducing code example:

import numpy as np
A = np.array([[-1], [7], [-26]])

Error message:

Traceback (most recent call last): File "C:Users amimMiniconda3libsite-packages umpycore__init__.py", line 17, in from . import multiarray File "C:Users amimMiniconda3libsite-packages umpycoremultiarray.py", line 14, in from . import overrides File "C:Users amimMiniconda3libsite-packages umpycoreoverrides.py", line 7, in from numpy.core._multiarray_umath import ( ImportError: DLL load failed: Не найден указанный модуль.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "c:/Users/ramim/Desktop/22/Matrix library/alsf.py", line 3, in import numpy as np File "C:Users amimMiniconda3libsite-packages umpy__init__.py", line 142, in from . import core File "C:Users amimMiniconda3libsite-packages umpycore__init__.py", line 47, in raise ImportError(msg) ImportError:

IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!

Importing the numpy c-extensions failed. - Try uninstalling and reinstalling numpy. - If you have already done that, then: 1. Check that you expected to use Python3.7 from "C:Users amimMiniconda3python.exe", and that you have no directories in your PATH or PYTHONPATH that can interfere with the Python and numpy version "1.17.3" you're trying to use. 2. If (1) looks fine, you can open a new issue at https://github.com/numpy/numpy/issues. Please include details on: - how you installed Python - how you installed numpy - your operating system - whether or not you have multiple versions of Python installed - if you built from source, your compiler versions and ideally a build log

  • If you're working with a numpy git repository, try git clean -xdf (removes all files not under version control) and rebuild numpy.

Note: this error has many possible causes, so please don't comment on an existing issue about this - open a new one instead.

Original error was: DLL load failed: Не найден указанный модуль.

Numpy/Python version information:

Python 3.7.5 Numpy 1.17.3

I tried to uninstall and install the numpy library again, but it was useless. Note: when I type in the teminal conda install numpy, it says:

All requested packages already installed

That's how I checked if numpy is really installed!

How to solve that?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Try to uninstall numpy and setuptools first:

  1. pip uninstall -y numpy

  2. pip uninstall -y setuptools

  3. pip install setuptools

  4. pip install numpy

Borrowed from solution provided by mehdiHadji here- https://github.com/ipython/ipyparallel/issues/349


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...