pytorch - 如何在导入 Torch 时修复“无法初始化类型 TensorProto DataType”错误?
问题描述
我在没有 GPU 支持的情况下使用 pip3 命令为我的 windows pc 安装了 pytorch。但是当我尝试导入torch时它给出了一个错误。
起初,有一个不同的错误说 numpy 版本不匹配,我将 numpy 更新到最新版本。
import torch
RuntimeError Traceback (most recent call last)
<ipython-input-10-c031d3dd82fc> in <module>()
----> 1 import torch
C:\Users\iamuraptha\Anaconda3\lib\site-packages\torch\__init__.py in <module>()
82 pass
83
---> 84 from torch._C import *
85
86 __all__ += [name for name in dir(_C)
RuntimeError: generic_type: cannot initialize type "TensorProtoDataType": an object with that name is already defined
解决方案
我重新安装了anaconda,然后为pytorch创建了一个虚拟环境。现在一切正常
推荐阅读
- c# - 生成每天重置的票号的最佳方法
- python - 将图像排序为 NP 数组
- javascript - TypeError: undefined is not a function ('...currencyFilter.map...' 附近)
- javascript - 创建 div 的水平滚动 div
- javascript - discord.js collector.on('end') 没有在他应该发布的频道中发布收集到的东西
- c# - 检查 JValue 是否是 C# 中的数组
- javascript - 不使用硒登录谷歌
- .net - .Net Core API 的最大文件上传大小应该是多少?
- javascript - 如何在 typescript 中通过类型安全来增强“this”
- typescript - 特定字符串文字以外的任何字符串的 TypeScript 类型