我尝试通过脚本检查 torch 是否已经正确安装:
import torch
print(torch.__version__)
并且得到了如下结果:
AttributeError: module 'torch' has no attribute 'version'我已经检查过我的虚拟环境中是否安装了torch:
pip freeze
我尝试按照https://pytorch.org/上的建议,通过conda和pip两种方式安装了以下it技术相关的软件包:
- torch==1.7.1+cu110
- torchaudio==0.7.2
- torchvision==0.8.2+cu110
环境信息如下:
- 操作系统:Ubuntu 18.04
- GPU型号:Geforce RTX 3070
- 驱动版本:460.39
- Cuda Toolkit版本:V11.0.194
- Cudnn版本:V8.0.5.39
- Python版本:V3.6.9
不明白问题出在哪里。
torch.py
,这会导致您的本地脚本遮盖了名为torch
的模块。而不是导入pytorch模块,您正在导入您的本地torch.py
(/home/evgeniy/cnn/torch.py)。 - undefined