AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / ubuntu / 问题 / 1374841
Accepted
jeremy_rutman
jeremy_rutman
Asked: 2021-11-11 20:21:47 +0800 CST2021-11-11 20:21:47 +0800 CST 2021-11-11 20:21:47 +0800 CST

python3.10 with numpy - ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'

  • 772

我正在尝试为 python3.10(不在 venv 中)安装 numpy。我使用安装了 python 3.10

sudo apt install python3.10

pip 似乎没有安装所以我做了

jeremy@jeremy-Blade:/$ python3.10 -m pip install numpy
jeremy@jeremy-Blade:/$ wget https://bootstrap.pypa.io/get-pip.py
jeremy@jeremy-Blade:/$ python3.10 get-pip.py
jeremy@jeremy-Blade:/$ python3.10 -m pip --version 
pip 21.3.1 from /home/jeremy/.local/lib/python3.10/site-packages/pip (python 3.10)

然后尝试


jeremy@jeremy-Blade:/$ python3.10 -m pip install numpy
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: numpy in /usr/lib/python3/dist-packages (1.17.4)

但是当我尝试导入 numpy 时:

Python 3.10.0 (default, Oct  4 2021, 22:09:55) [GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy 
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/numpy/core/__init__.py", line 17, in <module>
    from . import multiarray
  File "/usr/lib/python3/dist-packages/numpy/core/multiarray.py", line 14, in <module>
    from . import overrides
  File "/usr/lib/python3/dist-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 "<stdin>", line 1, in <module>
  File "/usr/lib/python3/dist-packages/numpy/__init__.py", line 142, in <module>
    from . import core
  File "/usr/lib/python3/dist-packages/numpy/core/__init__.py", line 47, 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.10 from "/usr/bin/python3.10",
     and that you have no directories in your PATH or PYTHONPATH that can
     interfere with the Python and numpy version "1.17.4" 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
...
Original error was: No module named 'numpy.core._multiarray_umath'

我的路是

jeremy@jeremy-Blade:/$env|grep PATH
LD_LIBRARY_PATH=/usr/local/cuda-10.2/targets/x86_64-linux/lib/stubs
PATH=/home/jeremy/.local/bin:/usr/local/cuda-10.2/bin:/usr/local/cuda-10.2/targets/x86_64-linux/lib/stubs:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

(所以 PYTHONPATH 未设置 - 如果我将其设置为 /usr/bin/python3.10 这似乎不会改变任何东西),并且按照错误消息中的建议,我似乎在这里没有看到任何问题。(我为 python3.10 卸载并重新安装了 numpy,没有看到问题的变化)我的操作系统是 ubuntu 20.04。对不起,如果这是明显的或与 numpy 无关的东西。

python
  • 1 1 个回答
  • 4779 Views

1 个回答

  • Voted
  1. Best Answer
    jeremy_rutman
    2021-11-12T12:52:19+08:002021-11-12T12:52:19+08:00

    看起来 python3.10 可以使用的 numpy (1.17) 的现有版本,实际上并不是所需的最低版本 (1.21)。升级可以解决问题:

    jeremy@jeremy-Blade:~$ python3.10 -m pip install --user --upgrade numpy
    Requirement already satisfied: numpy in /usr/lib/python3/dist-packages (1.17.4)
    Collecting numpy
      Using cached numpy-1.21.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (15.9 MB)
    Installing collected packages: numpy
    Successfully installed numpy-1.21.4
    jeremy@jeremy-Blade:~$ python3.10 
    Python 3.10.0 (default, Oct  4 2021, 22:09:55) [GCC 9.3.0] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import numpy
    >>> 
    
    • 0

相关问题

  • 默认的字符编码是什么?

  • 如何使用 pynotify 创建可点击通知?

  • 有没有安装 Django 1.2.*(最新稳定版)的简单方法?

  • 为 Python 应用程序设置构建系统

  • 为我的 PPA 创建包时遇到问题

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何运行 .sh 脚本?

    • 16 个回答
  • Marko Smith

    如何安装 .tar.gz(或 .tar.bz2)文件?

    • 14 个回答
  • Marko Smith

    如何列出所有已安装的软件包

    • 24 个回答
  • Marko Smith

    无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗?

    • 25 个回答
  • Martin Hope
    Flimm 如何在没有 sudo 的情况下使用 docker? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    Ivan 如何列出所有已安装的软件包 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    La Ode Adam Saputra 无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗? 2010-11-30 18:12:48 +0800 CST
  • Martin Hope
    David Barry 如何从命令行确定目录(文件夹)的总大小? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher “以下软件包已被保留:”为什么以及如何解决? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford 如何删除 PPA? 2010-07-30 01:09:42 +0800 CST

热门标签

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve