ERROR: Failed cleaning build dir for numpy Failed > to build numpy ERROR

问题

(d2l) PS D:\project\test_st> pip install numpy==1.16.2
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple

Collecting 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 numpy
1.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)

解决方法

匹配pythonnumpy的版本

当降低numpy<1.16.3版本,但需要注意你的python版本为2.73.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)

会出现下面的提醒与报错:
在这里插入图片描述
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值