Py学习  »  Python

新机器上的Python 3.10模块安装错误

Joe • 3 年前 • 1341 次点击  

Python 3.10已经发布,当我尝试安装 NumPy 它给了我: NumPy 1.21.2 may not yet support Python 3.10. .我该怎么办?

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/129489
 
1341 次点击  
文章 [ 3 ]  |  最新文章 3 年前
mirekphd
Reply   •   1 楼
mirekphd    3 年前

如果你不介意使用Docker和Debian python:3.10 (== python:3.10-bullseye )docker集装箱公司 pip 预装的。还有一些包裹,比如 numpy 可以使用 pip install 然后跑下去 python 3.10(但祝其他套餐好运:)。

这是一些PoC和证据 努比 真的很管用:

$ docker run -it --rm --name python310 -u 0 python:3.10 bash -c 'pip --version; pip install numpy --user --no-cache; pip show numpy; python -c "import numpy as np; print(np.ones(5))"'

…应该输出:

pip 21.2.4 from /usr/local/lib/python3.10/site-packages/pip (python 3.10)
Collecting numpy
  Downloading numpy-1.21.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (15.9 MB)
     |████████████████████████████████| 15.9 MB 36.9 MB/s 
Installing collected packages: numpy
  WARNING: The scripts f2py, f2py3 and f2py3.10 are installed in '/root/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed numpy-1.21.4
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
WARNING: You are using pip version 21.2.4; however, version 21.3.1 is available.
You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.
Name: numpy
Version: 1.21.4
Summary: NumPy is the fundamental package for array computing with Python.
Home-page: https://www.numpy.org
Author: Travis E. Oliphant et al.
Author-email: 
License: BSD
Location: /root/.local/lib/python3.10/site-packages
Requires: 
Required-by: 
[1. 1. 1. 1. 1.]
Steve Barnes
Reply   •   2 楼
Steve Barnes    3 年前

由于您使用的是MS Windows,因此也可以使用 pipwin -这个 仅限windows的实用程序 pip是可安装的,可以下载并安装许多“非官方”版本 (由优秀的克里斯托夫·高尔克提供) 从科学的角度来看 https://www.lfd.uci.edu/~gohlke/pythonlibs/ 但是,不用猜测要下载和安装哪些文件。

会话可能会运行:

pip install pipwin
pipwin install numpy

或者你可以使用 py 发射器如中所示:

py -3.10 -mpip install pipwin
py -3.10 -mpipwin refresh
py -3.10 -mpipwin install numpy

中间一步告诉pipwin填充其当前可用内容的列表。

AXO
Reply   •   3 楼
AXO    3 年前

如果在Windows上,numpy还没有发布Python 3.10的预编译程序。不过,您可以尝试在 https://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy . 专门寻找

  • numpy‑1.21.2+mkl‑cp310‑cp310‑win_amd64.whl
  • numpy‑1.21.2+mkl‑cp310‑cp310‑win32.whl

取决于您的系统架构。

下载文件后,转到下载目录并运行 pip install "<filename>.whl" .)

(我亲自安装了 numpy–1.21.2+mkl–cp310–cp310–win–amd64。whl 这对我很管用。)