Опитвам се да използвам NumPy в Python. Току-що инсталирах Anaconda Python 3.7 и всичко изглеждаше гладко. Не мога обаче да импортирам numpy (използвайки реда import numpy
). Когато го направя, получавам следната грешка:
C:\Users\jsmith\anaconda3\lib\site-packages\numpy\__init__.py:140: UserWarning: mkl-service package failed to import, therefore Intel(R) MKL initialization ensuring its correct out-of-the box operation under condition when Gnu OpenMP had already been loaded by Python process is not assured. Please install mkl-service package, see http://github.com/IntelPython/mkl-service
from . import _distributor_init
Traceback (most recent call last):
File "C:\Users\jsmith\anaconda3\lib\site-packages\numpy\core\__init__.py", line 24, in <module>
from . import multiarray
File "C:\Users\jsmith\anaconda3\lib\site-packages\numpy\core\multiarray.py", line 14, in <module>
from . import overrides
File "C:\Users\jsmith\anaconda3\lib\site-packages\numpy\core\overrides.py", line 7, in <module>
from numpy.core._multiarray_umath import (
ImportError: DLL load failed: The specified module could not be found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\jsmith\anaconda3\lib\site-packages\numpy\__init__.py", line 142, in <module>
from . import core
File "C:\Users\jsmith\anaconda3\lib\site-packages\numpy\core\__init__.py", line 54, in <module>
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\jsmith\anaconda3\python.exe",
and that you have no directories in your PATH or PYTHONPATH that can
interfere with the Python and numpy version "1.18.1" 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: The specified module could not be found.
Мога да го видя в раздела Enviorments на Anaconda Navigator и когато се опитам да го използвам в Eclipse(Pydev), той се показва под принудителни вградени функции. Разгледах моя PYTHONPATH и както моето enviorment в Eclipse, така и моята базова python директория (jsmith/anaconda3) са в него. Опитах да импортирам други библиотеки, които виждам при принудителни вграждания, и те работят добре, но изглежда, че numpy е единствената с проблеми. Извикването на pip install numpy
ми казва, че вече е инсталиран с версия 1.18.1. Разгледах тази страница за препълване на стека, и изпълни първата команда в отговора (conda create -n test numpy python=3.7 --no-default-packages
) в подканата на анаконда. Това проработи и тогава разбрах, че тестът е специфичен за въпроса, вместо това опитах base и получих тази грешка:
CondaValueError: The target prefix is the base prefix. Aborting.
Извикването на conda activate base
обаче не направи нищо.
pip uninstall numpy
последвано отconda install -n base numpy
- person cel   schedule 18.07.2020conda install -n base numpy
просто използвахpip install numpy
- person John Smith   schedule 18.07.2020