简体   繁体   English

如何将 NumPy 1.18.5 for Python3.8 与 Anaconda 一起使用?

[英]How can i use NumPy 1.18.5 for Python3.8 with Anaconda?

I am having problems with the Numpy 1.18.5 version.我在使用 Numpy 1.18.5 版本时遇到问题。 I have the Python3.8 and they seem to be incompatible.我有 Python3.8,但它们似乎不兼容。 I am working with Anaconda Navigator.我正在使用 Anaconda Navigator。 So sorry if this is very basic but i am a beginner in this amazing world.很抱歉,如果这是非常基本的,但我是这个神奇世界的初学者。 Thanks a lot in advance.非常感谢。 This is the message error i get:这是我收到的消息错误:

$ python Bikeshare.py
C:\Users\Xabi\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 "Bikeshare.py", line 2, in <module>
    import pandas as pd
  File "C:\Users\Xabi\anaconda3\lib\site-packages\pandas\__init__.py", line 16, in <module>
    raise ImportError(
ImportError: Unable to import required dependencies:
numpy:

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

Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.

We have compiled some common reasons and troubleshooting tips at:

    https://numpy.org/devdocs/user/troubleshooting-importerror.html

Please note and check the following:

  * The Python version is: Python3.8 from "C:\Users\Xabi\anaconda3\python.exe"
  * The NumPy version is: "1.18.5"

and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.

Original error was: DLL load failed while importing _multiarray_umath: Das angegebene Modul wurde nicht gefunden. 

You missed to activate the conda environment, hence the error.您错过了激活 conda 环境,因此出现错误。 Try尝试

C:\> conda activate
(Anaconda3) C:\> python Bikeshare.py

If activation doesn't work, your install is incomplete.如果激活不起作用,则您的安装不完整。 Try尝试

C:\> conda init

first.第一的。

I can see the error accures when the script imports Pandas.我可以看到脚本导入 Pandas 时出现的错误。 So you might need to change your pandas version too.因此,您可能也需要更改您的 Pandas 版本。

To check your Numpy: Try to find your NumPy version first.检查您的 Numpy:首先尝试找到您的 NumPy 版本。

import numpy as np
print(np.__version__)
1.18.5

If it's not the version you're looking for, uninstall the current version and install the specified version:如果不是您要找的版本,请卸载当前版本并安装指定版本:

pip uninstall numpy
pip install numpy==1.18.5

I am not sure if it's a good idea or not but I always use python's two previous version to make sure all my dependencies are all met.我不确定这是否是一个好主意,但我总是使用 python 的两个以前的版本来确保我的所有依赖项都得到满足。 Since Python 3.9 is available I use python 3.7由于 Python 3.9 可用,我使用 python 3.7

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM