【问题标题】:numpy error was occurred in Pypy condition在 Pypy 条件下发生 numpy 错误
【发布时间】:2022-01-19 05:13:12
【问题描述】:

我在 pypy 中使用 pycharm 运行了 numpy 代码。 我刚刚打印了 np.array 但没有工作。

import numpy as np
print(np.array([1, 2, 3]))

这就是我所做的一切

不知道有没有关系,我的python版本是3.9.2

下面的代码是我得到的错误信息

Traceback (most recent call last):
  File "C:\Users\tnvlaos456\Desktop\pypy38\lib\site-packages\numpy\core\__init__.py", line 22, in <module>
    from . import multiarray
  File "C:\Users\tnvlaos456\Desktop\pypy38\lib\site-packages\numpy\core\multiarray.py", line 12, in <module>
    from . import overrides
  File "C:\Users\tnvlaos456\Desktop\pypy38\lib\site-packages\numpy\core\overrides.py", line 7, in <module>
    from numpy.core._multiarray_umath import (
ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:/Users/tnvlaos456/Desktop/practice/practice.py", line 1, in <module>
    import numpy as np
  File "C:\Users\tnvlaos456\Desktop\pypy38\lib\site-packages\numpy\__init__.py", line 145, in <module>
    from . import core
  File "C:\Users\tnvlaos456\Desktop\pypy38\lib\site-packages\numpy\core\__init__.py", line 48, in <module>
    raise ImportError(msg)
ImportError: 

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\tnvlaos456\Desktop\practice\Scripts\pypy.exe"
  * The NumPy version is: "1.20.0"

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

Original error was: No module named 'numpy.core._multiarray_umath'

【问题讨论】:

    标签: pypy


    【解决方案1】:

    这令人困惑。你说

    python版本是3.9.2

    但是没有这样的pypy发布版本。

    NumPy 打印出来

    Python版本为:Python3.8 from "C:\Users\tnvlaos456\Desktop\practice\Scripts\pypy.exe"

    但正在从 C:\Users\tnvlaos456\Desktop\pypy38\lib\site-packages 加载 NumPy 1.20.0

    那么它是:Python 3.9.2、来自C:\Users\tnvlaos456\Desktop\practice 的 PyPy3.8 还是来自C:\Users\tnvlaos456\Desktop\pypy38 的 PyPy3.8?

    你是如何在机器上安装 PyPy 和 NumPy 的?

    【讨论】:

    • 我在python官网安装了python 3.9.2,在pypy官网安装了pypy3.8。将系统路径添加到“此 PC”后,使用 PIP 在 pypy 文件夹中安装了 Numpy for pypy
    猜你喜欢
    • 1970-01-01
    • 2021-01-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多