文章目录
问题
(d2l) PS D:\project\test_st> pip install numpy==1.16.2
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simpleCollecting numpy==1.16.2 Downloading
https://pypi.tuna.tsinghua.edu.cn/packages/cf/8d/6345b4f32b37945fedc1e027e83970005fc9c699068d2f566b82826515f2/numpy-1.16.2.zip
(5.1 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 5.1/5.1 MB 6.0 MB/s eta 0:00:00 Preparing metadata (setup.py) … done Building wheels for
collected packages: numpy Building wheel for numpy (setup.py) …
error error: subprocess-exited-with-error× python setup.py bdist_wheel did not run successfully. │ exit
code: 1 ╰─> [17 lines of output]
Running from numpy source directory.
C:\Users\admin\AppData\Local\Temp\pip-install-0pyo81at\numpy_a8c97502239c47d7b6aa2749a831007d\numpy\distutils\misc_util.py:476:
SyntaxWarning: “is” with a literal. Did you mean “==”?
return is_string(s) and (‘*’ in s or ‘?’ is s)
Traceback (most recent call last):
File “”, line 2, in
File “”, line 34, in
File “C:\Users\admin\AppData\Local\Temp\pip-install-0pyo81at\numpy_a8c97502239c47d7b6aa2749a831007d\setup.py”,
line 415, in
setup_package()
File “C:\Users\admin\AppData\Local\Temp\pip-install-0pyo81at\numpy_a8c97502239c47d7b6aa2749a831007d\setup.py”,
line 394, in setup_package
from numpy.distutils.core import setup
File “C:\Users\admin\AppData\Local\Temp\pip-install-0pyo81at\numpy_a8c97502239c47d7b6aa2749a831007d\numpy\distutils\core.py”,
line 26, in
from numpy.distutils.command import config, config_compiler,
File “C:\Users\admin\AppData\Local\Temp\pip-install-0pyo81at\numpy_a8c97502239c47d7b6aa2749a831007d\numpy\distutils\command\config.py”,
line 19, in
from numpy.distutils.mingw32ccompiler import generate_manifest
File “C:\Users\admin\AppData\Local\Temp\pip-install-0pyo81at\numpy_a8c97502239c47d7b6aa2749a831007d\numpy\distutils\mingw32ccompiler.py”,
line 34, in
from distutils.msvccompiler import get_build_version as get_build_msvc_version
ModuleNotFoundError: No module named ‘distutils.msvccompiler’
[end of output]note: This error originates from a subprocess, and is likely not a
problem with pip. ERROR: Failed building wheel for numpy Running
setup.py clean for numpy error: subprocess-exited-with-error× python setup.py clean did not run successfully. │ exit code: 1
╰─> [10 lines of output]
Running from numpy source directory.`setup.py clean` is not supported, use one of the following instead: - `git clean -xdf` (cleans all files) - `git clean -Xdf` (cleans all versioned files, doesn't touch files that aren't checked into the git repo) Add `--force` to your command to use it anyway if you must (unsupported). [end of output]
note: This error originates from a subprocess, and is likely not a
problem with pip. ERROR: Failed cleaning build dir for numpy Failed
to build numpy ERROR: ERROR: Failed to build installable wheels for
some pyproject.toml based projects (numpy) (d2l) PS
D:\project\test_st> pip install numpy1.16.2 Looking in indexes:
https://pypi.tuna.tsinghua.edu.cn/simple Collecting numpy1.16.2
Using cached
https://pypi.tuna.tsinghua.edu.cn/packages/cf/8d/6345b4f32b37945fedc1e027e83970005fc9c699068d2f566b82826515f2/numpy-1.16.2.zip
(5.1 MB) Preparing metadata (setup.py) … done Building wheels for
collected packages: numpy Building wheel for numpy (setup.py) …
error error: subprocess-exited-with-error× python setup.py bdist_wheel did not run successfully. │ exit
code: 1 ╰─> [17 lines of output]
Running from numpy source directory.
C:\Users\admin\AppData\Local\Temp\pip-install-as22iokr\numpy_ee62379734464183a9bae051cca214d8\numpy\distutils\misc_util.py:476:
SyntaxWarning: “is” with a literal. Did you mean “==”?
return is_string(s) and (‘*’ in s or ‘?’ is s)
Traceback (most recent call last):
File “”, line 2, in
File “”, line 34, in
File “C:\Users\admin\AppData\Local\Temp\pip-install-as22iokr\numpy_ee62379734464183a9bae051cca214d8\setup.py”,
line 415, in
setup_package()- `git clean -xdf` (cleans all files) - `git clean -Xdf` (cleans all versioned files, doesn't touch files that aren't checked into the git repo) Add `--force` to your command to use it anyway if you must (unsupported). [end of output]
note: This error originates from a subprocess, and is likely not a
problem with pip. ERROR: Failed cleaning build dir for numpy Failed
to build numpy ERROR: ERROR: Failed to build installable wheels for
some pyproject.toml based projects (numpy)
解决方法
匹配python
和numpy
的版本
当降低numpy<1.16.3
版本,但需要注意你的python
版本为2.7
和3.5-3.7
# python = 3.7
conda create -n name python=3.7
pip install numpy==1.16.2
Numpy官网:https://numpy.org/doc/stable/reference/generated/numpy.load.html
错误原因:python和numpy版本不兼容
查看我python的版本和numpy的版本
numpy=1.16.1和1.16.2
,与我环境中的python=3.9
不兼容,会出现以下错误:
ModuleNotFoundError: No module named ‘distutils.msvccompiler’
[end of output]- `git clean -xdf` (cleans all files) - `git clean -Xdf` (cleans all versioned files, doesn't touch files that aren't checked into the git repo) Add `--force` to your command to use it anyway if you must (unsupported). [end of output]
note: This error originates from a subprocess, and is likely not a
problem with pip. ERROR: Failed cleaning build dir for numpy Failed
to build numpy ERROR: ERROR: Failed to build installable wheels for
some pyproject.toml based projects (numpy)
会出现下面的提醒与报错: