小秦哥 发表于 2025-4-18 02:40:14

Linux CUDA12.0安装Pytorch、Tensorflow、conda/pip添加清华源

(1) Pytorch安装成功

PyTorch
Previous PyTorch Versions | PyTorch
GPU版PyTorch安装、GPU版TensorFlow安装(详细教程)_安装pytorch和tensorflow-CSDN博客
ccuda12.0 安装 pytorch_cuda12.0对应的pytorch版本-CSDN博客

汤米尼克说cuda向下兼容
准备安装CUDA11.8对应下令
https://i-blog.csdnimg.cn/direct/c465001ad1db44c3833704d5bb36f68d.png

GitHub - pytorch/vision: Datasets, Transforms and Models specific to Computer Vision
https://i-blog.csdnimg.cn/direct/4be9a9def5984362be4daae7526656fe.png
# 11.8
conda create -n pt21_c python==3.8
conda activate pt21_c

pip install torch==2.1.0 torchvision==0.16.0 torchaudio==2.1.0 --index-url https://download.pytorch.org/whl/cu118

conda install pytorch==2.1.0 torchvision==0.16.0 torchaudio==2.1.0 pytorch-cuda=11.8 -c pytorch -c nvidia

#由于网速太慢,开始山路十八弯...

$ conda config --show channels
channels:
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r

$ conda config --show-sources
==> /home/user/anaconda3/.condarc <==
channels:
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r

==> envvars <==
allow_softlinks: False

#conda添加清华镜像源
#法1:
vim ~/anaconda3/.condarc #直接编辑配置文件
channels:
- http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
- http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
- http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
- http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
- http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch-lts/
- http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/simpleitk/
show_channel_urls: true
default_channels:
- http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
- http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
- http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
custom_channels:
conda-forge: http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
msys2: http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
bioconda: http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
menpo: http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
pytorch: http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
pytorch-lts: http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
simpleitk: http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud

#法2:(一个个添加麻烦)
conda config --add channels http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --add channels http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
conda config --add channels http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/

conda config --add channels http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro

conda config --set show_channel_urls yes
# conda config --remove-key channels #conda换回默认下载源
这个操作之后
$ conda config --show-sources
==> /home/user/anaconda3/.condarc <==
channels:
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r

==> /home/user/.condarc <==
channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
show_channel_urls: True

==> envvars <==
allow_softlinks: False
# 之后用vim ~/.condarc查看添加的镜像

$ conda install pytorch==2.1.0 torchvision==0.16.0 torchaudio==2.1.0 pytorch-cuda=11.8 #包括11.7和12.1的命令都试过了,都是类似报错!
Solving environment: failed

LibMambaUnsatisfiableError: Encountered problems while solving:
- nothing provides cuda-cudart >=11.8,<12.0 needed by pytorch-cuda-11.8-h7e8668a_3

Could not solve for environment specs
The following packages are incompatible
└─ pytorch-cuda 11.8**is not installable because there are no viable options
   ├─ pytorch-cuda 11.8 would require
   │└─ cuda-cudart >=11.8,<12.0 , which does not exist (perhaps a missing channel);
   └─ pytorch-cuda 11.8 would require
      └─ cuda 11.8.* , which does not exist (perhaps a missing channel).
# https://mp.weixin.qq.com/s/VK7QJlfxfnmwnLkZQYg1SQ
# https://mp.weixin.qq.com/s/D28hXv_k1nCjlAWnXN4wZQ
# cudatoolkit 是一个已编译好的 CUDA 库,它会在运行时被 PyTorch 使用,而不依赖于系统全局的 CUDA 安装。同时 torch 也会自动安装与指定版本的 PyTorch 兼容的 cuDNN
$ conda install cudatoolkit=11.8.0 #依旧安装失败

# 查看下载源
$ pip config list #默认下载源无输出
# CUDA 12.1
#pip添加清华镜像源
#~/.pip/pip.conf(新建文件夹.pip和文件pip.conf),写入:

index-url = https://pypi.tuna.tsinghua.edu.cn/simple

trusted-host = pypi.tuna.tsinghua.edu.cn
# 再次查看下载源
$ pip config list
global.index-url='https://pypi.tuna.tsinghua.edu.cn/simple'
install.trusted-host='pypi.tuna.tsinghua.edu.cn'

$ pip install torch==2.1.0 torchvision==0.16.0 torchaudio==2.1.0 #安装失败,出现CUDA版本不兼容的问题
>> import torch
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/user/anaconda3/envs/pt21_c/lib/python3.8/site-packages/torch/__init__.py", line 235, in <module>
    from torch._C import *# noqa: F403
ImportError: /home/user/anaconda3/envs/pt21_c/lib/python3.8/site-packages/torch/lib/../../nvidia/cusparse/lib/libcusparse.so.12: undefined symbol: __nvJitLinkAddData_12_1, version libnvJitLink.so.12

$ pip install torch-2.1.0+cu118-cp38-cp38-linux_x86_64.whl torchvision-0.16.0+cu118-cp38-cp38-linux_x86_64.whl torchaudio-2.1.0+cu118-cp38-cp38-linux_x86_64.whl
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
ERROR: torch-2.1.0+cu118-cp38-cp38-linux_x86_64.whl is not a supported wheel on this platform.

由于我是12.0,连轮子都不能安装吗,救命!!!

https://i-blog.csdnimg.cn/direct/1546ce6b6128462dad5fa34e126a93c1.png $ pip install torch==2.1.0 torchvision==0.16.0 torchaudio==2.1.0https://i-blog.csdnimg.cn/direct/9efa7cb1fa3f4860846d780f357d97d8.png
https://i-blog.csdnimg.cn/direct/33d13f876a5040fb847630f025097a48.png
#终于
pip install torch==2.1.0 torchvision==0.16.0 torchaudio==2.1.0 --index-url https://download.pytorch.org/whl/cu118 #我回到开始,竟然成功了(灬ꈍ ꈍ灬),看来还是要相信官网,不能盲目追求网速!

测试:
python
import torch
if torch.cuda.is_available():
    num_gpus = torch.cuda.device_count()
    print(f"检测到 {num_gpus} 个可用的 GPU 设备。")
    for i in range(num_gpus):
      gpu_name = torch.cuda.get_device_name(i)
      print(f"GPU {i}: {gpu_name}")
else:
    print("未检测到可用的 GPU 设备,当前使用 CPU 进行计算。")
exit()
记录一个网速bug :
ERROR: Exception:
Traceback (most recent call last):
File "/home/user/anaconda3/envs/pt21_c/lib/python3.8/site-packages/pip/_vendor/urllib3/response.py", line 438, in _error_catcher
    yield
File "/home/user/anaconda3/envs/pt21_c/lib/python3.8/site-packages/pip/_vendor/urllib3/response.py", line 561, in read
    data = self._fp_read(amt) if not fp_closed else b""
File "/home/user/anaconda3/envs/pt21_c/lib/python3.8/site-packages/pip/_vendor/urllib3/response.py", line 527, in _fp_read
    return self._fp.read(amt) if amt is not None else self._fp.read()
File "/home/user/anaconda3/envs/pt21_c/lib/python3.8/site-packages/pip/_vendor/cachecontrol/filewrapper.py", line 98, in read
    data: bytes = self.__fp.read(amt)
File "/home/user/anaconda3/envs/pt21_c/lib/python3.8/http/client.py", line 454, in read
    n = self.readinto(b)
File "/home/user/anaconda3/envs/pt21_c/lib/python3.8/http/client.py", line 498, in readinto
    n = self.fp.readinto(b)
File "/home/user/anaconda3/envs/pt21_c/lib/python3.8/socket.py", line 669, in readinto
    return self._sock.recv_into(b)
File "/home/user/anaconda3/envs/pt21_c/lib/python3.8/ssl.py", line 1241, in recv_into
    return self.read(nbytes, buffer)
File "/home/user/anaconda3/envs/pt21_c/lib/python3.8/ssl.py", line 1099, in read
    return self._sslobj.read(len, buffer)
ConnectionResetError: Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/user/anaconda3/envs/pt21_c/lib/python3.8/site-packages/pip/_internal/cli/base_command.py", line 105, in _run_wrapper
    status = _inner_run()
File "/home/user/anaconda3/envs/pt21_c/lib/python3.8/site-packages/pip/_internal/cli/base_command.py", line 96, in _inner_run
    return self.run(options, args)
File "/home/user/anaconda3/envs/pt21_c/lib/python3.8/site-packages/pip/_internal/cli/req_command.py", line 67, in wrapper
    return func(self, options, args)
File "/home/user/anaconda3/envs/pt21_c/lib/python3.8/site-packages/pip/_internal/commands/install.py", line 379, in run
    requirement_set = resolver.resolve(
File "/home/user/anaconda3/envs/pt21_c/lib/python3.8/site-packages/pip/_internal/resolution/resolvelib/resolver.py", line 95, in resolve
    result = self._result = resolver.resolve(
File "/home/user/anaconda3/envs/pt21_c/lib/python3.8/site-packages/pip/_vendor/resolvelib/resolvers.py", line 546, in resolve
    state = resolution.resolve(requirements, max_rounds=max_rounds)
File "/home/user/anaconda3/envs/pt21_c/lib/python3.8/site-packages/pip/_vendor/resolvelib/resolvers.py", line 397, in resolve
    self._add_to_criteria(self.state.criteria, r, parent=None)
File "/home/user/anaconda3/envs/pt21_c/lib/python3.8/site-packages/pip/_vendor/resolvelib/resolvers.py", line 173, in _add_to_criteria
    if not criterion.candidates:
File "/home/user/anaconda3/envs/pt21_c/lib/python3.8/site-packages/pip/_vendor/resolvelib/structs.py", line 156, in __bool__
    return bool(self._sequence)
File "/home/user/anaconda3/envs/pt21_c/lib/python3.8/site-packages/pip/_internal/resolution/resolvelib/found_candidates.py", line 174, in __bool__
    return any(self)
File "/home/user/anaconda3/envs/pt21_c/lib/python3.8/site-packages/pip/_internal/resolution/resolvelib/found_candidates.py", line 162, in <genexpr>
    return (c for c in iterator if id(c) not in self._incompatible_ids)
File "/home/user/anaconda3/envs/pt21_c/lib/python3.8/site-packages/pip/_internal/resolution/resolvelib/found_candidates.py", line 53, in _iter_built
    candidate = func()
File "/home/user/anaconda3/envs/pt21_c/lib/python3.8/site-packages/pip/_internal/resolution/resolvelib/factory.py", line 187, in _make_candidate_from_link
    base: Optional = self._make_base_candidate_from_link(
File "/home/user/anaconda3/envs/pt21_c/lib/python3.8/site-packages/pip/_internal/resolution/resolvelib/factory.py", line 233, in _make_base_candidate_from_link
    self._link_candidate_cache = LinkCandidate(
File "/home/user/anaconda3/envs/pt21_c/lib/python3.8/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 304, in __init__
    super().__init__(
File "/home/user/anaconda3/envs/pt21_c/lib/python3.8/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 159, in __init__
    self.dist = self._prepare()
File "/home/user/anaconda3/envs/pt21_c/lib/python3.8/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 236, in _prepare
    dist = self._prepare_distribution()
File "/home/user/anaconda3/envs/pt21_c/lib/python3.8/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 315, in _prepare_distribution
    return preparer.prepare_linked_requirement(self._ireq, parallel_builds=True)
File "/home/user/anaconda3/envs/pt21_c/lib/python3.8/site-packages/pip/_internal/operations/prepare.py", line 527, in prepare_linked_requirement
    return self._prepare_linked_requirement(req, parallel_builds)
File "/home/user/anaconda3/envs/pt21_c/lib/python3.8/site-packages/pip/_internal/operations/prepare.py", line 598, in _prepare_linked_requirement
    local_file = unpack_url(
File "/home/user/anaconda3/envs/pt21_c/lib/python3.8/site-packages/pip/_internal/operations/prepare.py", line 170, in unpack_url
    file = get_http_url(
File "/home/user/anaconda3/envs/pt21_c/lib/python3.8/site-packages/pip/_internal/operations/prepare.py", line 111, in get_http_url
    from_path, content_type = download(link, temp_dir.path)
File "/home/user/anaconda3/envs/pt21_c/lib/python3.8/site-packages/pip/_internal/network/download.py", line 148, in __call__
    for chunk in chunks:
File "/home/user/anaconda3/envs/pt21_c/lib/python3.8/site-packages/pip/_internal/cli/progress_bars.py", line 55, in _rich_progress_bar
    for chunk in iterable:
File "/home/user/anaconda3/envs/pt21_c/lib/python3.8/site-packages/pip/_internal/network/utils.py", line 65, in response_chunks
    for chunk in response.raw.stream(
File "/home/user/anaconda3/envs/pt21_c/lib/python3.8/site-packages/pip/_vendor/urllib3/response.py", line 622, in stream
    data = self.read(amt=amt, decode_content=decode_content)
File "/home/user/anaconda3/envs/pt21_c/lib/python3.8/site-packages/pip/_vendor/urllib3/response.py", line 587, in read
    raise IncompleteRead(self._fp_bytes_read, self.length_remaining)
File "/home/user/anaconda3/envs/pt21_c/lib/python3.8/contextlib.py", line 131, in __exit__
    self.gen.throw(type, value, traceback)
File "/home/user/anaconda3/envs/pt21_c/lib/python3.8/site-packages/pip/_vendor/urllib3/response.py", line 455, in _error_catcher
    raise ProtocolError("Connection broken: %r" % e, e)
pip._vendor.urllib3.exceptions.ProtocolError: ("Connection broken: ConnectionResetError(104, 'Connection reset by peer')", ConnectionResetError(104, 'Connection reset by peer'))
网络不好的意思 Anaconda中如何配置国内镜像源安装外部库(含conda永久配置和pip临时配置方法)_conda中科大镜像源-CSDN博客
Linux安装anaconda,换镜像,创建虚拟环境_linux anaconda镜像-CSDN博客
linux 添加清华镜像并安装 pytorch_清华镜像 pytorch-CSDN博客
添加清华镜像-CSDN博客
Linux/Windows下 Anaconda 添加、删除清华/中科大镜像源_linux 删除镜像源-CSDN博客
 https://blog.csdn.net/qq_51465572/article/details/142374467

Windows 和 Linux 给 python pip 设置永久清华镜像源_python windous清华源-CSDN博客  
⭐️pip使用清华镜像源安装_pip清华源-CSDN博客
pip和conda 添加国内清华镜像 让他下的更快_pip 和 conda 网络毗连速度慢,可以尝试使用镜像,-CSDN博客
GPU版PyTorch安装、GPU版TensorFlow安装(详细教程)_安装pytorch和tensorflow-CSDN博客
(2)TensorFlow安装成功

非常钟安装Tensorflow-gpu2.6.0+本机CUDA12 以及numpy+matplotlib各包版本和谐题目_tensorflow cuda12-CSDN博客
非常钟安装Tensorflow-gpu2.6.0+本机CUDA12 以及numpy+matplotlib各包版本和谐题目,按照自己的来:_tensorflow cuda 12-CSDN博客
【win11 cuda12.0安装tensorflow-gpu】_tensorflow cuda12-CSDN博客
TensorFlow GPU 2.10+CUDA+cuDNN全环境设置指南及安装教程(已避坑)_tensorflow2.10-CSDN博客 TensorFlow-GPU 2.7.0安装教程及PyCharm接入指南(实用于弟子党,详细教程,Windows 10,Anaconda3,Python 3.9)-物联沃-IOTWORD物联网


#安装成功:十分钟安装Tensorflow-gpu2.6.0+本机CUDA12 以及numpy+matplotlib各包版本协调问题
conda env list
conda create -n tf26_c python==3.9
conda activate tf26_c
conda install cudatoolkit=11.2.0
conda install cudnn=8.1.0.77
pip install tensorflow-gpu==2.6.0 protobuf==3.20.0 numpy==1.19.5 matplotlib==3.3.4

测试:
python
import tensorflow as tf
gpu_devices = tf.config.list_physical_devices('GPU')
if gpu_devices:
    print("可用的 GPU 设备:", gpu_devices)
else:
    print("未检测到可用的 GPU 设备。")
exit()

整合如下:
if tf.test.is_gpu_available():
    gpus = tf.config.list_physical_devices('GPU')
    num_gpus = len(gpus)
    print(f"检测到 {num_gpus} 个可用的 GPU 设备。")
    for i, gpu in enumerate(gpus):
      gpu_name = gpu.name
      print(f"GPU {i}: {gpu_name}")
else:
    print("未检测到可用的 GPU 设备,当前使用 CPU 进行计算。")
记录两个安装失败的环境: 
#TensorFlow-GPU 2.7.0
# 安装失败1:【win11 cuda12.0安装tensorflow-gpu】
conda create -n tf27_c python==3.8
conda activate tf27_c
pip install tensorflow-gpu==2.7.0 protobuf==3.19.0
conda deactivate
conda remove -n tf27_c --all

# 安装失败2:
(tf27_c) user@user:~$ conda list
# packages in environment at /home/user/anaconda3/envs/tf27_c:
#
# Name                  Version                   BuildChannel
_libgcc_mutex             0.1               conda_forge    http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
_openmp_mutex             4.5                     2_gnu    http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
absl-py                   2.2.2                  pypi_0    pypi
astunparse                1.6.3                  pypi_0    pypi
c-ares                  1.19.1               h5eee18b_0    defaults
ca-certificates         2025.2.25            h06a4308_0    defaults
cachetools                5.5.2                  pypi_0    pypi
certifi                   2025.1.31                pypi_0    pypi
charset-normalizer      3.4.1                  pypi_0    pypi
cudatoolkit               11.2.0               h73cb219_9    http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
cudnn                     8.1.0.77             h90431f1_0    http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
curl                      7.88.1               hdc1c0ab_0    http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
flatbuffers               2.0.7                  pypi_0    pypi
gast                      0.4.0                  pypi_0    pypi
google-auth               2.38.0                   pypi_0    pypi
google-auth-oauthlib      1.0.0                  pypi_0    pypi
google-pasta            0.2.0                  pypi_0    pypi
graalpy                   22.3.0          0_graalvm_native    http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
grpcio                  1.70.0                   pypi_0    pypi
h5py                      3.11.0                   pypi_0    pypi
idna                      3.10                     pypi_0    pypi
importlib-metadata      8.5.0                  pypi_0    pypi
keras                     2.7.0                  pypi_0    pypi
keras-preprocessing       1.1.2                  pypi_0    pypi
krb5                      1.20.1               h143b758_1    defaults
ld_impl_linux-64          2.43               h712a8e2_4    http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
libclang                  18.1.1                   pypi_0    pypi
libcurl                   7.88.1               hdc1c0ab_0    http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
libedit                   3.1.20230828         h5eee18b_0    defaults
libev                     4.33               h7f8727e_1    defaults
libffi                  3.2.1                         1    http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
libgcc                  14.2.0               h767d61c_2    http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
libgcc-ng               14.2.0               h69a702a_2    http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
libgomp                   14.2.0               h767d61c_2    http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
liblzma                   5.6.4                hb9d3cd8_0    http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
liblzma-devel             5.6.4                hb9d3cd8_0    http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
libnghttp2                1.52.0               h61bc06f_0    http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
libssh2                   1.10.0               hdbd6064_3    defaults
libstdcxx               14.2.0               h8f9b012_2    http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
libstdcxx-ng            14.2.0               h4852527_2    http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
libzlib                   1.3.1                hb9d3cd8_2    http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
markdown                  3.7                      pypi_0    pypi
markupsafe                2.1.5                  pypi_0    pypi
ncurses                   6.5                  h2d0b736_3    http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
numpy                     1.24.4                   pypi_0    pypi
oauthlib                  3.2.2                  pypi_0    pypi
openssl                   3.0.16               h5eee18b_0    defaults
opt-einsum                3.4.0                  pypi_0    pypi
patch                     2.7.6             h7b6447c_1001    defaults
pip                     24.3.1             pyh8b19718_0    http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
protobuf                  3.19.0                   pypi_0    pypi
pyasn1                  0.6.1                  pypi_0    pypi
pyasn1-modules            0.4.2                  pypi_0    pypi
python                  3.8.5         0_native223_graalpy    http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
python_abi                3.8             4_graalpy223_38_native    http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
readline                  8.2                  h8c095d6_2    http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
requests                  2.32.3                   pypi_0    pypi
requests-oauthlib         2.0.0                  pypi_0    pypi
rsa                     4.9                      pypi_0    pypi
setuptools                75.3.0             pyhd8ed1ab_0    http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
six                     1.17.0                   pypi_0    pypi
sqlite                  3.31.1               h7b6447c_0    defaults
tensorboard               2.14.0                   pypi_0    pypi
tensorboard-data-server   0.7.2                  pypi_0    pypi
tensorflow-estimator      2.7.0                  pypi_0    pypi
tensorflow-gpu            2.7.0                  pypi_0    pypi
tensorflow-io-gcs-filesystem 0.34.0                   pypi_0    pypi
termcolor               2.4.0                  pypi_0    pypi
tk                        8.6.7                hc745277_3    defaults
typing-extensions         4.13.1                   pypi_0    pypi
urllib3                   2.2.3                  pypi_0    pypi
werkzeug                  3.0.6                  pypi_0    pypi
wheel                     0.45.1             pyhd8ed1ab_0    http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
wrapt                     1.17.2                   pypi_0    pypi
xz                        5.6.4                hbcc6ac9_0    http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
xz-gpl-tools            5.6.4                hbcc6ac9_0    http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
xz-tools                  5.6.4                hb9d3cd8_0    http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
zipp                      3.20.2                   pypi_0    pypi
zlib                      1.3.1                hb9d3cd8_2    http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
(tf27_c) user@user:~$ python
Python 3.8.5 (Fri Jan 13 20:30:28 CST 2023)
on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
#TensorFlow-GPU 2.10.0
conda install cudnn=8.2.1
conda install cudatoolkit=11.3.1
pip install tensorflow-gpu==2.10.0
(tf210_c) user@user:~$ conda list
# packages in environment at /home/user/anaconda3/envs/tf210_c:
#
# Name                  Version                   BuildChannel
_libgcc_mutex             0.1               conda_forge    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
_openmp_mutex             4.5                     2_gnu    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
absl-py                   2.2.2                  pypi_0    pypi
astunparse                1.6.3                  pypi_0    pypi
bzip2                     1.0.8                h4bc722e_7    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
ca-certificates         2025.1.31            hbcca054_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
cachetools                5.5.2                  pypi_0    pypi
certifi                   2025.1.31                pypi_0    pypi
charset-normalizer      3.4.1                  pypi_0    pypi
cudatoolkit               11.3.1            hb98b00a_13    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
cudnn                     8.2.1.32             h86fa8c9_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
flatbuffers               25.2.10                  pypi_0    pypi
gast                      0.4.0                  pypi_0    pypi
google-auth               2.38.0                   pypi_0    pypi
google-auth-oauthlib      0.4.6                  pypi_0    pypi
google-pasta            0.2.0                  pypi_0    pypi
grpcio                  1.71.0                   pypi_0    pypi
h5py                      3.13.0                   pypi_0    pypi
idna                      3.10                     pypi_0    pypi
importlib-metadata      8.6.1                  pypi_0    pypi
keras                     2.10.0                   pypi_0    pypi
keras-preprocessing       1.1.2                  pypi_0    pypi
ld_impl_linux-64          2.43               h712a8e2_4    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
libclang                  18.1.1                   pypi_0    pypi
libffi                  3.4.6                h2dba641_1    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
libgcc                  14.2.0               h767d61c_2    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
libgcc-ng               14.2.0               h69a702a_2    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
libgomp                   14.2.0               h767d61c_2    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
liblzma                   5.8.1                hb9d3cd8_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
liblzma-devel             5.8.1                hb9d3cd8_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
libnsl                  2.0.1                hd590300_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
libsqlite               3.49.1               hee588c1_2    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
libstdcxx               14.2.0               h8f9b012_2    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
libstdcxx-ng            14.2.0               h4852527_2    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
libuuid                   2.38.1               h0b41bf4_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
libxcrypt               4.4.36               hd590300_1    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
libzlib                   1.3.1                hb9d3cd8_2    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
markdown                  3.7                      pypi_0    pypi
markupsafe                3.0.2                  pypi_0    pypi
ncurses                   6.5                  h2d0b736_3    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
numpy                     1.22.0                   pypi_0    pypi
oauthlib                  3.2.2                  pypi_0    pypi
openssl                   3.4.1                h7b32b05_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
opt-einsum                3.4.0                  pypi_0    pypi
packaging               24.2                     pypi_0    pypi
pip                     25.0.1             pyh8b19718_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
protobuf                  3.19.6                   pypi_0    pypi
pyasn1                  0.6.1                  pypi_0    pypi
pyasn1-modules            0.4.2                  pypi_0    pypi
python                  3.9.21          h9c0c6dc_1_cpython    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
readline                  8.2                  h8c095d6_2    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
requests                  2.32.3                   pypi_0    pypi
requests-oauthlib         2.0.0                  pypi_0    pypi
rsa                     4.9                      pypi_0    pypi
setuptools                78.1.0             pyhff2d567_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
six                     1.17.0                   pypi_0    pypi
sqlite                  3.49.1               h9eae976_2    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
tensorboard               2.10.1                   pypi_0    pypi
tensorboard-data-server   0.6.1                  pypi_0    pypi
tensorboard-plugin-wit    1.8.1                  pypi_0    pypi
tensorflow-estimator      2.10.0                   pypi_0    pypi
tensorflow-gpu            2.10.0                   pypi_0    pypi
tensorflow-io-gcs-filesystem 0.37.1                   pypi_0    pypi
termcolor               3.0.1                  pypi_0    pypi
tk                        8.6.13          noxft_h4845f30_101    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
typing-extensions         4.13.1                   pypi_0    pypi
tzdata                  2025b                h78e105d_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
urllib3                   2.3.0                  pypi_0    pypi
werkzeug                  3.1.3                  pypi_0    pypi
wheel                     0.45.1             pyhd8ed1ab_1    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
wrapt                     1.17.2                   pypi_0    pypi
xz                        5.8.1                hbcc6ac9_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
xz-gpl-tools            5.8.1                hbcc6ac9_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
xz-tools                  5.8.1                hb9d3cd8_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
zipp                      3.21.0                   pypi_0    pypi
zlib                      1.3.1                hb9d3cd8_2    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
(tf210_c) user@user:~$ python
Python 3.9.21 | packaged by conda-forge | (main, Dec5 2024, 13:51:40)
on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>




免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
页: [1]
查看完整版本: Linux CUDA12.0安装Pytorch、Tensorflow、conda/pip添加清华源