from mxnet import np,报错提示error: legacy-install-failure× Encountered error while trying to install

1、pip install mxnet,失败,提示:

      No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
      error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  WARNING: No metadata found in d:\program files (x86)\python3.9.4\lib\site-packages
  Rolling back uninstall of numpy
  Moving to d:\program files (x86)\python3.9.4\lib\site-packages\numpy-1.22.3.dist-info\
   from D:\Program Files (x86)\python3.9.4\Lib\site-packages\~umpy-1.22.3.dist-info
  Moving to d:\program files (x86)\python3.9.4\lib\site-packages\numpy\
   from D:\Program Files (x86)\python3.9.4\Lib\site-packages\~-mpy
  Moving to d:\program files (x86)\python3.9.4\scripts\f2py.exe
   from C:\Users\lilin\AppData\Local\Temp\pip-uninstall-a6sj89ba\f2py.exe
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> numpy

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
WARNING: Ignoring invalid distribution -ip (d:\program files (x86)\python3.9.4\lib\site-packages)
WARNING: Ignoring invalid distribution -ip (d:\program files (x86)\python3.9.4\lib\site-packages)
WARNING: Ignoring invalid distribution -ip (d:\program files (x86)\python3.9.4\lib\site-packages)

2、尝试

(1)pip uninstall numpy,失败

(2)解决常见pip install错误方法;

https://www.youtube.com/watch?v=YVfvLYM2Yes&ab_channel=MustufaBaighttps://www.youtube.com/watch?v=YVfvLYM2Yes&ab_channel=MustufaBaig(3)采用手动下载mxnet文件,然后加载。

在mxnet文件本地路径下输入cmd,输入"pip install <name>"

F:\Download>pip install mxnet-1.9.0+mkl-cp39-cp39-win_amd64.whl

文件下载链接:手动搜索mxnet

https://www.lfd.uci.edu/~gohlke/pythonlibs/#basemap

遇到同类问题:

1、python - Gettingerror: legacy-install-failure, while installing basemap - Stack Overflow 

2、python - How to resolve the error of legacy-install-failure? - Stack Overflow 

其他链接:

mxnet-cu112 · PyPI

----------

安装mxnet后,运行之后再次报错:

FileNotFoundError: Could not find module 'D:\Program Files (x86)\python3.9.4\lib\site-packages\mxnet\libmxnet.dll' (or one of its dependencies). Try using the full path with constructor syntax.

暂时未解决,相同问题.

1、https://github.com/apache/incubator-mxnet/issues/17887

------------

附录:

1、

ModuleNotFoundError: No module named 'pip'
解决办法
python -m ensurepip
python -m pip install --upgrade pip

2、Get Started | Apache MXNet

3、https://github.com/apache/incubator-mxnet/releases

4、下载链接

https://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy

5、CUDA Toolkit 11.7 Downloads | NVIDIA Developer

6、mxnet对应cuda版本下载:Profile of mxnet · PyPI

7、Latest supported Visual C++ Redistributable downloads | Microsoft Docs

8、ensurepip — Bootstrapping the pip installer — Python 3.10.4 documentation

9、Amazon SageMaker Studio Lab - Amazon SageMaker

10、Troubleshooting ImportError — NumPy v1.23.dev0 Manual

11、From torch._C import * : No Torch._C! - #3 by skaminsky - PyTorch Forums

  • 5
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 5
    评论
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值