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)

from mxnet import np,报错提示error: legacy-install-failure× Encountered error while trying to install_第1张图片

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 "

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.

from mxnet import np,报错提示error: legacy-install-failure× Encountered error while trying to install_第2张图片

暂时未解决,相同问题.

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

你可能感兴趣的:(Python,mxnet,人工智能,深度学习)