YOLOv5环境搭建

YOLOv5环境搭建,第1张

1. 安装conda

Conda 是开源的包管理系统和环境管理系统,可以安装软件包的多个版本和依赖,而且方便切换。
可以安装Miniconda,实现安装conda的目的。
下载地址 ,注意对应的python版本和系统位数。

1.1 Python>=3.7.0

这里下载的版本是3.7.9的windows 64位的版本。
下载地址:
https://www.python.org/downloads/windows/

注意 在安装conda时,默认是带python的,也就是这个单独的python可以不安装。

2. PyTorch>=1.7
conda install pytorch torchvision torchaudio cudatoolkit=11.3 -c pytorch

这意味着conda会从官方源下载指定的包。我们需要把尾端的“-c pytorch”去掉, conda才会从我们设置的国内源去下载。

因为安装了mamba,所以可以用mamba安装

mamba install pytorch torchvision torchaudio cudatoolkit=11.3

下面这个是用conda安装的过程


(envZhao) C:\Users\zzh_m>conda install pytorch torchvision torchaudio cudatoolkit=11.3 -c pytorch
Collecting package metadata (current_repodata.json): done
Solving environment: done


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

Please update conda by running

    $ conda update -n base -c defaults conda


WARNING conda.gateways.disk.delete:unlink_or_rename_to_trash(144): Could not remove or rename D:\Programs\conda411\pkgs\pytorch-1.11.0-py3.7_cuda11.3_cudnn8_0.tar.bz2.  Please remove this file manually (you may need to reboot to free file handles)
WARNING conda.gateways.disk.delete:unlink_or_rename_to_trash(144): Could not remove or rename D:\Programs\conda411\pkgs\torchvision-0.12.0-py37_cu113.tar.bz2.  Please remove this file manually (you may need to reboot to free file handles)

## Package Plan ##

  environment location: D:\Programs\conda411\envs\envZhao

  added / updated specs:
    - cudatoolkit=11.3
    - 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             |py37h2bbff1b_1003         337 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-2021.10.8          |   py37haa95532_2         152 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    cffi-1.15.0                |   py37h2bbff1b_1         222 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
    cryptography-36.0.0        |   py37h21b164f_0         1.0 MB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    cudatoolkit-11.3.1         |       h59b6b97_2       545.3 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-9d                    |       h2bbff1b_0         283 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          |   py37h2bbff1b_0          49 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    mkl_fft-1.3.1              |   py37h277e83a_0         135 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    mkl_random-1.2.2           |   py37hf11a4ad_0         216 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    numpy-1.21.5               |   py37h7a0a035_1          25 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    numpy-base-1.21.5          |   py37hca35cd5_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               |   py37hdc2b20a_0         916 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              |           py37_1          28 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    pytorch-1.11.0             |py3.7_cuda11.3_cudnn8_0        1.23 GB  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
    tk-8.6.11                  |       h2bbff1b_0         3.3 MB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    torchvision-0.12.0         |       py37_cu113         9.0 MB  pytorch
    typing_extensions-4.1.1    |     pyh06a4308_0          28 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    urllib3-1.26.9             |   py37haa95532_0         188 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    win_inet_pton-1.1.0        |   py37haa95532_0          35 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    xz-5.2.5                   |       h62dcd97_0         244 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    zlib-1.2.12                |       h8cc25b3_2         116 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:        1.90 GB

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-py37h2bbff1b_1003
  cffi               anaconda/pkgs/main/win-64::cffi-1.15.0-py37h2bbff1b_1
  charset-normalizer anaconda/pkgs/main/noarch::charset-normalizer-2.0.4-pyhd3eb1b0_0
  cryptography       anaconda/pkgs/main/win-64::cryptography-36.0.0-py37h21b164f_0
  cudatoolkit        anaconda/pkgs/main/win-64::cudatoolkit-11.3.1-h59b6b97_2
  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-9d-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-py37h2bbff1b_0
  mkl_fft            anaconda/pkgs/main/win-64::mkl_fft-1.3.1-py37h277e83a_0
  mkl_random         anaconda/pkgs/main/win-64::mkl_random-1.2.2-py37hf11a4ad_0
  numpy              anaconda/pkgs/main/win-64::numpy-1.21.5-py37h7a0a035_1
  numpy-base         anaconda/pkgs/main/win-64::numpy-base-1.21.5-py37hca35cd5_1
  pillow             anaconda/pkgs/main/win-64::pillow-9.0.1-py37hdc2b20a_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-py37_1
  pytorch            pytorch/win-64::pytorch-1.11.0-py3.7_cuda11.3_cudnn8_0
  pytorch-mutex      pytorch/noarch::pytorch-mutex-1.0-cuda
  requests           anaconda/pkgs/main/noarch::requests-2.27.1-pyhd3eb1b0_0
  six                anaconda/pkgs/main/noarch::six-1.16.0-pyhd3eb1b0_1
  tk                 anaconda/pkgs/main/win-64::tk-8.6.11-h2bbff1b_0
  torchaudio         pytorch/win-64::torchaudio-0.11.0-py37_cu113
  torchvision        pytorch/win-64::torchvision-0.12.0-py37_cu113
  typing_extensions  anaconda/pkgs/main/noarch::typing_extensions-4.1.1-pyh06a4308_0
  urllib3            anaconda/pkgs/main/win-64::urllib3-1.26.9-py37haa95532_0
  win_inet_pton      anaconda/pkgs/main/win-64::win_inet_pton-1.1.0-py37haa95532_0
  xz                 anaconda/pkgs/main/win-64::xz-5.2.5-h62dcd97_0
  zlib               anaconda/pkgs/main/win-64::zlib-1.2.12-h8cc25b3_2
  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)?
3 安装pycharm,然后配置编译环境

默认安装就可以。
在配置python解释器时,把利用mamba安装的pytorch环境目录添加到编译器中。例如这里选择第一个配置选项,虚拟环境配置,然后选择利用现有环境,
把envZhao这个虚拟环境中的python添加上就可以。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/734742.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-04-27
下一篇 2022-04-27

发表评论

登录后才能评论

评论列表(0条)

保存