Python 3.10 已发布,当我尝试安装时NumPy
,它给了我这个:NumPy 1.21.2 may not yet support Python 3.10.
. 我该怎么办?
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
并且它对我有用。)
由于您在 MS-Windows 上,您还可以使用pipwin - 这个仅限 Windows 的实用程序是 pip 可安装的,并且可以从https://下载和安装许多科学的“非官方”构建(由优秀的 Christoph Gohlke 提供)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 填充其当前可用内容的列表。
如果您不介意使用 Docker 和 Debian,官方python:3.10
(== python:3.10-bullseye
) docker 容器已pip
预先安装。并且某些软件包numpy
可以使用 3.10 安装pip install
并在python
3.10 下运行(尽管其他软件包好运:)。
numpy
下面是一些真正有效的 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.]