问题描述
在我的机器上,我无法“ pip install火炬”-我得到了臭名昭著的“单一源外部管理的错误”-我无法修复它,并使用了Anaconda的“ conda安装火炬”。
仍然很容易检查版本-torch.__version__
但是如何查看它的安装位置-火炬的主目录? 假设我同时通过pip和conda安装了两个手电筒-如何知道在项目中使用了哪一个?
import torch
print(torch__version__)
解决方法
您可以获取在您的脚本中导入的割炬模块位置
import torch
print(torch.__file__)
,
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: [email protected]
License: BSD-3
Location: c:\programdata\anaconda3\lib\site-packages
Requires: numpy
Required-by: torchvision,torchtext,efficientunet-pytorch