提示:PyTorch 环境搭建
前言
提示:PyTorch 环境搭建:
基础环境参见:conda+jupyter+matplotlib.animation
提示:PyTorch 环境搭建
一、安装 PyTorch (cpu 版本),没钱买显卡我哭死了
pip查询可用版本
(base) root@4253996b109b:/app# pip index versions torch --index-url https://download.pytorch.org/whl/cpu WARNING: pip index is currently an experimental command. It may be removed/changed in a future release without prior warning.
torch (2.6.0+cpu)
Available versions: 2.6.0+cpu, 2.5.1+cpu, 2.5.0+cpu, 2.4.1+cpu, 2.4.0+cpu, 2.3.1+cpu, 2.3.0+cpu, 2.2.2+cpu, 2.2.1+cpu, 2.2.0+cpu
INSTALLED: 2.6.0+cpu
LATEST: 2.6.0+cpu
# cpu 版本
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
二、验证 PyTorch
(base) root@4253996b109b:/app# python
Python 3.12.2 | packaged by conda-forge | (main, Feb 16 2024, 20:50:58) [GCC 12.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
print("PyTorch 版本:", torch.__version__)
>>> print("PyTorch 版本:", torch.__version__)
PyTorch 版本: 2.6.0+cpu
>>>
或
或
(base) root@4253996b109b:/app# pip show torch
Name: torch
Version: 2.6.0+cpu
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-Clause
Location: /opt/conda/lib/python3.12/site-packages
Requires: filelock, fsspec, jinja2, networkx, setuptools, sympy, typing-extensions
Required-by: torchaudio, torchvision