在我的机器上,我无法“pip install torch”——我得到了臭名昭著的“单一源外部管理错误”——我无法修复它并使用了 anaconda 的“conda install torch”。不过,检查版本很容易 -torch.__version__但是如何查看它安装在哪里 - 火炬的主目录?假设如果我通过 pip 和 conda 安装了两个手电筒——如何知道项目中使用了哪个?import torch
print(torch__version__)
3 回答

慕盖茨4494581
TA贡献1850条经验 获得超11个赞
pip show torch在终端将为您提供所有必需的信息。
Name: torch
Version: 1.3.1
Summary: Tensors and Dynamic neural networks in Python with strong GPU acceleration
Home-page: https://pytorch.org/
Author: PyTorch Team
Author-email: packages@pytorch.org
License: BSD-3
Location: c:\programdata\anaconda3\lib\site-packages
Requires: numpy
Required-by: torchvision, torchtext, efficientunet-pytorch

四季花海
TA贡献1811条经验 获得超5个赞
如果您已经安装了PyTorch库,请打开Google Colab,粘贴以下代码并点击运行按钮:
import torch print(torch.__file__)
然后你会看到PyTorch的版本。
如果它不起作用,请访问https://pytorch.org/get-started/locally/并按照有关如何安装PyTorch 的说明进行操作,因为有时Python和PyTorch存在依赖关系问题。
添加回答
举报
0/150
提交
取消