【每天学习一点点】mxnet 版本运行失败问题
安装还是顺利的。
C:\Users\lj.huang>pip install mxnet-cu101
Looking in indexes: http://mirrors.aliyun.com/pypi/simple
Collecting mxnet-cu101
Downloading http://mirrors.aliyun.com/pypi/packages/e8/d9/79e15c2fcad215199813e72064177657674f5b69c3a89a15436dded51262/mxnet_cu101-1.5.0-py2.py3-none-win_amd64.whl (385.0 MB)
|████████████████████████████████| 385.0 MB 6.4 MB/s
Requirement already satisfied: graphviz<0.9.0,>=0.8.1 in c:\python38\lib\site-packages (from mxnet-cu101) (0.8.4)
Requirement already satisfied: requests<2.19.0,>=2.18.4 in c:\python38\lib\site-packages (from mxnet-cu101) (2.18.4)
Requirement already satisfied: numpy<1.17.0,>=1.8.2 in c:\python38\lib\site-packages (from mxnet-cu101) (1.16.6)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in c:\python38\lib\site-packages (from requests<2.19.0,>=2.18.4->mxnet-cu101) (3.0.4)
Requirement already satisfied: certifi>=2017.4.17 in c:\python38\lib\site-packages (from requests<2.19.0,>=2.18.4->mxnet-cu101) (2020.6.20)
Requirement already satisfied: idna<2.7,>=2.5 in c:\python38\lib\site-packages (from requests<2.19.0,>=2.18.4->mxnet-cu101) (2.6)
Requirement already satisfied: urllib3<1.23,>=1.21.1 in c:\python38\lib\site-packages (from requests<2.19.0,>=2.18.4->mxnet-cu101) (1.22)
Installing collected packages: mxnet-cu101
Successfully installed mxnet-cu101-1.5.0
但运行时有问题:
C:\Users\lj.huang>python
Python 3.8.4 (tags/v3.8.4:dfa645a, Jul 13 2020, 16:46:45) [MSC v.1924 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import mxnet
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python38\lib\site-packages\mxnet\__init__.py", line 24, in <module>
from .context import Context, current_context, cpu, gpu, cpu_pinned
File "C:\Python38\lib\site-packages\mxnet\context.py", line 24, in <module>
from .base import classproperty, with_metaclass, _MXClassPropertyMetaClass
File "C:\Python38\lib\site-packages\mxnet\base.py", line 213, in <module>
_LIB = _load_lib()
File "C:\Python38\lib\site-packages\mxnet\base.py", line 204, in _load_lib
lib = ctypes.CDLL(lib_path[0], ctypes.RTLD_LOCAL)
File "C:\Python38\lib\ctypes\__init__.py", line 373, in __init__
self._handle = _dlopen(self._name, mode)
FileNotFoundError: Could not find module 'C:\Python38\lib\site-packages\mxnet\libmxnet.dll' (or one of its dependencies). Try using the full path with constructor syntax.
怀疑是dll的依赖问题,下载了个Depends(http://www.dependencywalker.com/),看到libmxnet.dll文件依赖CUDA的dll,粗暴的解决将依赖的cuda dll都Copy到C:\Python38\lib\site-packages\mxnet\下。
问题真解决了。:)