pytorch - 导入 torch 时如何修复 'cannot initialize type TensorProto DataType'错误?

标签 pytorch torch

我在没有 GPU 支持的 Windows 电脑上使用 pip3 命令安装了 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创建了一个虚拟环境。现在一切正常

关于pytorch - 导入 torch 时如何修复 'cannot initialize type TensorProto DataType'错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54096158/

相关文章:

python - torch 库中的 BatchNorm1d() 方法如何工作?

torch - PyTorch : error message "torch has no [...] member"

machine-learning - 停止梯度更新架构中子网络的权重

python - 关于 Tensorflow 和 PyTorch 中的自定义操作

python - 如何在pytorch中打印Adadelta中的 "actual"学习率

python - 如何使用smac进行卷积神经网络的超参数优化?

python - required_grad 在 PyTorch 中做什么? (不要求_grad)

python - 如何将整数的pytorch张量转换为 boolean 值的张量?

pytorch - Faster RCNN模型(Pytorch)预测结果为空

python - 如何在python2.7中安装pytorch?