2️⃣在Python虚拟环境下使用 VS Code or PyCharm
Implementing PyTorch or PyCharm with VS code in virtual python environment
Last updated
Implementing PyTorch or PyCharm with VS code in virtual python environment
Last updated
## check_v.py
import torch
import sys
print("Python Version is",sys.version)
print("CUDA Version is", torch.version.cuda)
print("Pytorch Version is", torch.__version__)
print("Whether CUDA is supported by our system:", torch.cuda.is_available())
device_id = torch.cuda.current_device()
print("Current Device name:", torch.cuda.get_device_name(device_id))
cuda_id = "GPU available for cuda:"+str(device_id)
device = cuda_id if torch.cuda.is_available() else 'Only CPU can be used'
print(device)
## entryTorch.bat
call conda activate pytorch
python check_v.py