when importing pytorch microsoft visual C++ Redistributable is not installed(导入pytorch microsoft visual C++ Redistributable 时未安装)
问题描述
我在带有 GPU 的 Windows 机器上工作.我已经在 conda 环境中安装了 pytorch
I work in a windows machine with GPU. I have installed pytorch in a conda environment with
conda install pytorch torchvision cudatoolkit=10.1 -c pytorch
然后我运行 python 并在 python 内部执行 import torch 并收到此错误
then I run python and inside of python I do import torch and I get this error
Python 3.6.10 |Anaconda, Inc.| (default, May 7 2020, 19:46:08) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
Microsoft Visual C++ Redistributable is not installed, this may lead to the DLL load failure.
It can be downloaded at https://aka.ms/vs/16/release/vc_redist.x64.exe
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:Usersaliaganaconda3envspytorchPracticelibsite-packages orch\__init__.py", line 127, in <module>
raise err
OSError: [WinError 126] 指定されたモジュールが見つかりません。
Error loading "C:Usersaliaganaconda3envspytorchPracticelibsite-packages orchlibasmjit.dll"
or one of its dependencies.
>>>
我该如何纠正这个错误?
How can I correct this error?
推荐答案
从错误中的链接获取 Microsoft Visual C++ Redistributable 安装程序,在本例中为 这个.运行安装程序并在完成后再次启动配置 conda 的 shell
Get the Microsoft Visual C++ Redistributable installer from the link in the error, in this case is this. Run the installer and launch again your shell with conda configured when finished
这篇关于导入pytorch microsoft visual C++ Redistributable 时未安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!