ImportError: DLL加载失败:找不到指定模块问题求助
解决PyTorch 1.3.1 + Python 3.7.8的
ImportError: DLL load failed问题 以下是经过验证的修复步骤:
- 安装对应VC++运行库:PyTorch 1.3.1依赖Visual C++ Redistributable for Visual Studio 2019(x64版本),安装完成后重启系统。
- 重新安装PyTorch(确保完整性):先卸载现有版本,再用官方指定命令重新安装,避免包损坏或依赖缺失:
pip uninstall torch -y # CPU版本安装命令 pip install torch==1.3.1+cpu torchvision==0.4.2+cpu -f https://download.pytorch.org/whl/torch_stable.html # GPU版本(以CUDA 10.1为例)安装命令 pip install torch==1.3.1+cu101 torchvision==0.4.2+cu101 -f https://download.pytorch.org/whl/torch_stable.html - 排查依赖冲突:部分高版本numpy会与PyTorch 1.3.1不兼容,可降级numpy到兼容版本:
pip install numpy==1.19.5 - 修复系统PATH配置:将PyTorch安装目录下的
Lib\site-packages\torch\lib路径添加到系统环境变量PATH中,重启后再运行程序。
内容的提问来源于stack exchange,提问作者BHAVADHARINI RATHINASABAPATHY
相关产品推荐
相关产品推荐

