anaconda安装pytorch

conda create -n pytorch python=3.10.4

先去python官网查看最新安装版本3.10.4

输入后发现有个提示


==> WARNING: A newer version of conda exists. <==
  current version: 4.10.3
  latest version: 4.12.0

Please update conda by running

    $ conda update -n base -c defaults conda

有最新conda版本下载

## Package Plan ##

  environment location: C:\Users\yao\.conda\envs\pytorch

  added / updated specs:
    - python=3.10.4


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    ca-certificates-2022.3.29  |       haa95532_1         122 KB
    certifi-2020.6.20          |     pyhd3eb1b0_3         155 KB
    libffi-3.4.2               |       h604cdb4_1          43 KB
    openssl-1.1.1n             |       h2bbff1b_0         4.8 MB
    pip-21.2.4                 |  py310haa95532_0         1.9 MB
    python-3.10.4              |       hbb2ffb3_0        15.9 MB
    setuptools-61.2.0          |  py310haa95532_0         1.0 MB
    sqlite-3.38.2              |       h2bbff1b_0         807 KB
    tzdata-2022a               |       hda174b7_0         109 KB
    wheel-0.37.1               |     pyhd3eb1b0_0          33 KB
    wincertstore-0.2           |  py310haa95532_2          15 KB
    zlib-1.2.12                |       h8cc25b3_2         116 KB
    ------------------------------------------------------------
                                           Total:        25.0 MB

The following NEW packages will be INSTALLED:

  bzip2              pkgs/main/win-64::bzip2-1.0.8-he774522_0
  ca-certificates    pkgs/main/win-64::ca-certificates-2022.3.29-haa95532_1
  certifi            pkgs/main/noarch::certifi-2020.6.20-pyhd3eb1b0_3
  libffi             pkgs/main/win-64::libffi-3.4.2-h604cdb4_1
  openssl            pkgs/main/win-64::openssl-1.1.1n-h2bbff1b_0
  pip                pkgs/main/win-64::pip-21.2.4-py310haa95532_0
  python             pkgs/main/win-64::python-3.10.4-hbb2ffb3_0
  setuptools         pkgs/main/win-64::setuptools-61.2.0-py310haa95532_0
  sqlite             pkgs/main/win-64::sqlite-3.38.2-h2bbff1b_0
  tk                 pkgs/main/win-64::tk-8.6.11-h2bbff1b_0
  tzdata             pkgs/main/noarch::tzdata-2022a-hda174b7_0
  vc                 pkgs/main/win-64::vc-14.2-h21ff451_1
  vs2015_runtime     pkgs/main/win-64::vs2015_runtime-14.27.29016-h5e58377_2
  wheel              pkgs/main/noarch::wheel-0.37.1-pyhd3eb1b0_0
  wincertstore       pkgs/main/win-64::wincertstore-0.2-py310haa95532_2
  xz                 pkgs/main/win-64::xz-5.2.5-h62dcd97_0
  zlib               pkgs/main/win-64::zlib-1.2.12-h8cc25b3_2


Proceed ([y]/n)? n


CondaSystemExit: Exiting.

取消原先python安装,先更新conda

conda update -n base -c defaults conda

显示

Collecting package metadata (current_repodata.json): done
Solving environment: done

## Package Plan ##

  environment location: C:\ProgramData\Anaconda3

  added / updated specs:
    - conda


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    conda-4.12.0               |   py39haa95532_0        14.5 MB
    conda-package-handling-1.8.1|   py39h8cc25b3_0         729 KB
    ------------------------------------------------------------
                                           Total:        15.2 MB

The following packages will be UPDATED:

  conda                               4.10.3-py39haa95532_0 --> 4.12.0-py39haa95532_0
  conda-package-han~                   1.7.3-py39h8cc25b3_1 --> 1.8.1-py39h8cc25b3_0


Proceed ([y]/n)?

键入y确认

Proceed ([y]/n)? y


Downloading and Extracting Packages
conda-package-handli | 729 KB    | ############################################################################ | 100%
conda-4.12.0         | 14.5 MB   | ############################################################################ | 100%
Preparing transaction: done
Verifying transaction: failed

EnvironmentNotWritableError: The current user does not have write permissions to the target environment.
  environment location: C:\ProgramData\Anaconda3

conda装在虚拟机的C盘里没有权限写入,推出后以管理员身份打开conda,再次输入命令更新


Preparing transaction: done
Verifying transaction: done
Executing transaction: done
(base) C:\Windows\system32>conda -V
conda 4.12.0

查看版本已经更新

继续

conda create -n pytorch python=3.10.4
Collecting package metadata (current_repodata.json): done
Solving environment: done

## Package Plan ##

  environment location: C:\ProgramData\Anaconda3\envs\pytorch

  added / updated specs:
    - python=3.10.4


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    ca-certificates-2022.3.29  |       haa95532_1         122 KB
    certifi-2020.6.20          |     pyhd3eb1b0_3         155 KB
    libffi-3.4.2               |       h604cdb4_1          43 KB
    openssl-1.1.1n             |       h2bbff1b_0         4.8 MB
    pip-21.2.4                 |  py310haa95532_0         1.9 MB
    python-3.10.4              |       hbb2ffb3_0        15.9 MB
    setuptools-61.2.0          |  py310haa95532_0         1.0 MB
    sqlite-3.38.2              |       h2bbff1b_0         807 KB
    tzdata-2022a               |       hda174b7_0         109 KB
    wheel-0.37.1               |     pyhd3eb1b0_0          33 KB
    wincertstore-0.2           |  py310haa95532_2          15 KB
    zlib-1.2.12                |       h8cc25b3_2         116 KB
    ------------------------------------------------------------
                                           Total:        25.0 MB

The following NEW packages will be INSTALLED:

  bzip2              pkgs/main/win-64::bzip2-1.0.8-he774522_0
  ca-certificates    pkgs/main/win-64::ca-certificates-2022.3.29-haa95532_1
  certifi            pkgs/main/noarch::certifi-2020.6.20-pyhd3eb1b0_3
  libffi             pkgs/main/win-64::libffi-3.4.2-h604cdb4_1
  openssl            pkgs/main/win-64::openssl-1.1.1n-h2bbff1b_0
  pip                pkgs/main/win-64::pip-21.2.4-py310haa95532_0
  python             pkgs/main/win-64::python-3.10.4-hbb2ffb3_0
  setuptools         pkgs/main/win-64::setuptools-61.2.0-py310haa95532_0
  sqlite             pkgs/main/win-64::sqlite-3.38.2-h2bbff1b_0
  tk                 pkgs/main/win-64::tk-8.6.11-h2bbff1b_0
  tzdata             pkgs/main/noarch::tzdata-2022a-hda174b7_0
  vc                 pkgs/main/win-64::vc-14.2-h21ff451_1
  vs2015_runtime     pkgs/main/win-64::vs2015_runtime-14.27.29016-h5e58377_2
  wheel              pkgs/main/noarch::wheel-0.37.1-pyhd3eb1b0_0
  wincertstore       pkgs/main/win-64::wincertstore-0.2-py310haa95532_2
  xz                 pkgs/main/win-64::xz-5.2.5-h62dcd97_0
  zlib               pkgs/main/win-64::zlib-1.2.12-h8cc25b3_2
done
#
# To activate this environment, use
#
#     $ conda activate pytorch
#
# To deactivate an active environment, use
#
#     $ conda deactivate

完成建立了一个python是3.10.4版本的pytorch首先使用conda create -n pytorch python=3.7指令创建一个屋子,叫做pytorch。其中,conda是指调用conda包,create是创建的意思,-n后面跟着屋子的名字,python3.10.4指创建的屋子是python3.10版本的。

(base) C:\Windows\system32>conda env list
# conda environments:
#
base                  *  C:\ProgramData\Anaconda3
pytorch                  C:\ProgramData\Anaconda3\envs\pytorch

(base) C:\Windows\system32>conda activate pytorch

(pytorch) C:\Windows\system32>

激活环境后此时就运行在(pytorch)环境下了

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
conda config --set show_channel_urls yes

环境包换成清华源

https://pytorch.org/

进入pytorch官网

因为在虚拟机中安装且没有显卡,又更换了清华源所以复制灰色部位代码运行就好 

Collecting package metadata (current_repodata.json): done
Solving environment: done

## Package Plan ##

  environment location: C:\ProgramData\Anaconda3\envs\pytorch

  added / updated specs:
    - cpuonly
    - pytorch
    - torchaudio
    - torchvision


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    blas-1.0                   |              mkl           6 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    brotlipy-0.7.0             |py310h2bbff1b_1002         335 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    ca-certificates-2022.3.29  |       haa95532_1         122 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    certifi-2020.6.20          |     pyhd3eb1b0_3         155 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    cffi-1.15.0                |  py310h2bbff1b_1         225 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    charset-normalizer-2.0.4   |     pyhd3eb1b0_0          35 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    cpuonly-2.0                |                0           2 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch
    cryptography-36.0.0        |  py310h21b164f_0         1.0 MB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    freetype-2.10.4            |       hd328e21_0         466 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    idna-3.3                   |     pyhd3eb1b0_0          49 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    intel-openmp-2021.4.0      |    haa95532_3556         2.2 MB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    jpeg-9e                    |       h2bbff1b_0         292 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    libpng-1.6.37              |       h2a8f88b_0         333 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    libtiff-4.2.0              |       hd0e1b90_0         786 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    libuv-1.40.0               |       he774522_0         255 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    libwebp-1.2.2              |       h2bbff1b_0         658 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    lz4-c-1.9.3                |       h2bbff1b_1         132 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    mkl-2021.4.0               |     haa95532_640       114.9 MB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    mkl-service-2.4.0          |  py310h2bbff1b_0          48 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    mkl_fft-1.3.1              |  py310ha0764ea_0         136 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    mkl_random-1.2.2           |  py310h4ed8f06_0         221 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    numpy-1.21.5               |  py310h6d2d95c_1          25 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    numpy-base-1.21.5          |  py310h206c741_1         4.4 MB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    openssl-1.1.1n             |       h2bbff1b_0         4.8 MB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    pillow-9.0.1               |  py310hdc2b20a_0         923 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    pycparser-2.21             |     pyhd3eb1b0_0          94 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    pyopenssl-22.0.0           |     pyhd3eb1b0_0          50 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    pysocks-1.7.1              |  py310haa95532_0          28 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    pytorch-1.11.0             |     py3.10_cpu_0       129.9 MB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch
    pytorch-mutex-1.0          |              cpu           3 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch
    requests-2.27.1            |     pyhd3eb1b0_0          54 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    six-1.16.0                 |     pyhd3eb1b0_1          18 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    torchaudio-0.11.0          |        py310_cpu         2.9 MB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch
    torchvision-0.12.0         |        py310_cpu         7.4 MB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch
    typing_extensions-4.1.1    |     pyh06a4308_0          28 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    urllib3-1.26.9             |  py310haa95532_0         189 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    win_inet_pton-1.1.0        |  py310haa95532_0           9 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    zstd-1.4.9                 |       h19a0ad4_0         478 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    ------------------------------------------------------------
                                           Total:       273.6 MB

The following NEW packages will be INSTALLED:

  blas               anaconda/pkgs/main/win-64::blas-1.0-mkl
  brotlipy           anaconda/pkgs/main/win-64::brotlipy-0.7.0-py310h2bbff1b_1002
  cffi               anaconda/pkgs/main/win-64::cffi-1.15.0-py310h2bbff1b_1
  charset-normalizer anaconda/pkgs/main/noarch::charset-normalizer-2.0.4-pyhd3eb1b0_0
  cpuonly            anaconda/cloud/pytorch/noarch::cpuonly-2.0-0
  cryptography       anaconda/pkgs/main/win-64::cryptography-36.0.0-py310h21b164f_0
  freetype           anaconda/pkgs/main/win-64::freetype-2.10.4-hd328e21_0
  idna               anaconda/pkgs/main/noarch::idna-3.3-pyhd3eb1b0_0
  intel-openmp       anaconda/pkgs/main/win-64::intel-openmp-2021.4.0-haa95532_3556
  jpeg               anaconda/pkgs/main/win-64::jpeg-9e-h2bbff1b_0
  libpng             anaconda/pkgs/main/win-64::libpng-1.6.37-h2a8f88b_0
  libtiff            anaconda/pkgs/main/win-64::libtiff-4.2.0-hd0e1b90_0
  libuv              anaconda/pkgs/main/win-64::libuv-1.40.0-he774522_0
  libwebp            anaconda/pkgs/main/win-64::libwebp-1.2.2-h2bbff1b_0
  lz4-c              anaconda/pkgs/main/win-64::lz4-c-1.9.3-h2bbff1b_1
  mkl                anaconda/pkgs/main/win-64::mkl-2021.4.0-haa95532_640
  mkl-service        anaconda/pkgs/main/win-64::mkl-service-2.4.0-py310h2bbff1b_0
  mkl_fft            anaconda/pkgs/main/win-64::mkl_fft-1.3.1-py310ha0764ea_0
  mkl_random         anaconda/pkgs/main/win-64::mkl_random-1.2.2-py310h4ed8f06_0
  numpy              anaconda/pkgs/main/win-64::numpy-1.21.5-py310h6d2d95c_1
  numpy-base         anaconda/pkgs/main/win-64::numpy-base-1.21.5-py310h206c741_1
  pillow             anaconda/pkgs/main/win-64::pillow-9.0.1-py310hdc2b20a_0
  pycparser          anaconda/pkgs/main/noarch::pycparser-2.21-pyhd3eb1b0_0
  pyopenssl          anaconda/pkgs/main/noarch::pyopenssl-22.0.0-pyhd3eb1b0_0
  pysocks            anaconda/pkgs/main/win-64::pysocks-1.7.1-py310haa95532_0
  pytorch            anaconda/cloud/pytorch/win-64::pytorch-1.11.0-py3.10_cpu_0
  pytorch-mutex      anaconda/cloud/pytorch/noarch::pytorch-mutex-1.0-cpu
  requests           anaconda/pkgs/main/noarch::requests-2.27.1-pyhd3eb1b0_0
  six                anaconda/pkgs/main/noarch::six-1.16.0-pyhd3eb1b0_1
  torchaudio         anaconda/cloud/pytorch/win-64::torchaudio-0.11.0-py310_cpu
  torchvision        anaconda/cloud/pytorch/win-64::torchvision-0.12.0-py310_cpu
  typing_extensions  anaconda/pkgs/main/noarch::typing_extensions-4.1.1-pyh06a4308_0
  urllib3            anaconda/pkgs/main/win-64::urllib3-1.26.9-py310haa95532_0
  win_inet_pton      anaconda/pkgs/main/win-64::win_inet_pton-1.1.0-py310haa95532_0
  zstd               anaconda/pkgs/main/win-64::zstd-1.4.9-h19a0ad4_0

The following packages will be SUPERSEDED by a higher-priority channel:

  ca-certificates                                 pkgs/main --> anaconda/pkgs/main
  certifi                                         pkgs/main --> anaconda/pkgs/main
  openssl                                         pkgs/main --> anaconda/pkgs/main


Proceed ([y]/n)?

y确认后一系列安装会出现done完成

(pytorch) C:\Windows\system32>conda list
# packages in environment at C:\ProgramData\Anaconda3\envs\pytorch:
#
# Name                    Version                   Build  Channel
blas                      1.0                         mkl    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
brotlipy                  0.7.0           py310h2bbff1b_1002    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
bzip2                     1.0.8                he774522_0    defaults
ca-certificates           2022.3.29            haa95532_1    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
certifi                   2020.6.20          pyhd3eb1b0_3    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
cffi                      1.15.0          py310h2bbff1b_1    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
charset-normalizer        2.0.4              pyhd3eb1b0_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
cpuonly                   2.0                           0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch
cryptography              36.0.0          py310h21b164f_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
freetype                  2.10.4               hd328e21_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
idna                      3.3                pyhd3eb1b0_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
intel-openmp              2021.4.0          haa95532_3556    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
jpeg                      9e                   h2bbff1b_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
libffi                    3.4.2                h604cdb4_1    defaults
libpng                    1.6.37               h2a8f88b_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
libtiff                   4.2.0                hd0e1b90_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
libuv                     1.40.0               he774522_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
libwebp                   1.2.2                h2bbff1b_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
lz4-c                     1.9.3                h2bbff1b_1    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
mkl                       2021.4.0           haa95532_640    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
mkl-service               2.4.0           py310h2bbff1b_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
mkl_fft                   1.3.1           py310ha0764ea_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
mkl_random                1.2.2           py310h4ed8f06_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
numpy                     1.21.5          py310h6d2d95c_1    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
numpy-base                1.21.5          py310h206c741_1    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
openssl                   1.1.1n               h2bbff1b_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
pillow                    9.0.1           py310hdc2b20a_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
pip                       21.2.4          py310haa95532_0    defaults
pycparser                 2.21               pyhd3eb1b0_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
pyopenssl                 22.0.0             pyhd3eb1b0_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
pysocks                   1.7.1           py310haa95532_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
python                    3.10.4               hbb2ffb3_0    defaults
pytorch                   1.11.0             py3.10_cpu_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch
pytorch-mutex             1.0                         cpu    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch
requests                  2.27.1             pyhd3eb1b0_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
setuptools                61.2.0          py310haa95532_0    defaults
six                       1.16.0             pyhd3eb1b0_1    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
sqlite                    3.38.2               h2bbff1b_0    defaults
tk                        8.6.11               h2bbff1b_0    defaults
torchaudio                0.11.0                py310_cpu    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch
torchvision               0.12.0                py310_cpu    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch
typing_extensions         4.1.1              pyh06a4308_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
tzdata                    2022a                hda174b7_0    defaults
urllib3                   1.26.9          py310haa95532_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
vc                        14.2                 h21ff451_1    defaults
vs2015_runtime            14.27.29016          h5e58377_2    defaults
wheel                     0.37.1             pyhd3eb1b0_0    defaults
win_inet_pton             1.1.0           py310haa95532_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
wincertstore              0.2             py310haa95532_2    defaults
xz                        5.2.5                h62dcd97_0    defaults
zlib                      1.2.12               h8cc25b3_2    defaults
zstd                      1.4.9                h19a0ad4_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main

  • 13
    点赞
  • 27
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
要在Anaconda安装PyTorch,首先需要确保你已经安装了最新版本的Anaconda。可以通过以下步骤来安装PyTorch: 1. 首先,确保你已经安装Anaconda。如果你还没有安装Anaconda,你可以按照这个链接的指南进行安装: 2. 打开Anaconda Prompt,这是一个命令行工具。 3. 在Anaconda Prompt中,创建一个新的环境来安装PyTorch。你可以使用以下命令来创建一个名为"pytorch"的环境,并指定Python版本为3.8: ``` conda create -n pytorch python=3.8 ``` 4. 激活创建的环境。在Anaconda Prompt中运行以下命令: ``` conda activate pytorch ``` 5. 安装PyTorch。在激活的环境中,运行以下命令来安装PyTorch: ``` conda install pytorch ``` 6. 安装完成后,你可以使用以下命令来测试PyTorch是否成功安装: ``` python -c "import torch; print(torch.__version__)" ``` 这将打印出你安装PyTorch版本号,如果没有任何错误提示,说明PyTorch安装成功。 通过以上步骤,你就可以在Anaconda安装PyTorch了。请记住,在安装PyTorch之前,确保已经安装了最新版本的Anaconda,并按照所提供的步骤进行操作。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* [在Anaconda安装Pytorch的超详细步骤](https://blog.csdn.net/qq_45281807/article/details/112442423)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] - *3* [在Anaconda安装Pytorch的详细步骤](https://blog.csdn.net/weixin_46288319/article/details/124432168)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值