Anaconda使用

查看conda版本:

conda -V

查看支持的cuda版本:

nvidia -smi

输出为:

Mon Aug 12 12:35:26 2024       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 528.92       Driver Version: 528.92       CUDA Version: 12.0     |
|-------------------------------+----------------------+----------------------+
| GPU  Name            TCC/WDDM | Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  NVIDIA GeForce ... WDDM  | 00000000:01:00.0  On |                  N/A |
| N/A   42C    P8     3W /  75W |    176MiB /  4096MiB |      3%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
+-----------------------------------------------------------------------------+

可以看到最高为12.0

创建虚拟环境名字叫:jio,python版本是3.8

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


==> WARNING: A newer version of conda exists. <==
  current version: 4.8.3
  latest version: 24.5.0

Please update conda by running

    $ conda update -n base -c defaults conda



## Package Plan ##

  environment location: C:\Users\jiahao\.conda\envs\jio

  added / updated specs:
    - python=3.8


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    ca-certificates-2024.7.2   |       haa95532_0         128 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    libffi-3.4.4               |       hd77b12b_1         122 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    openssl-3.0.14             |       h827c3e9_0         7.8 MB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    pip-24.0                   |   py38haa95532_0         2.8 MB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    python-3.8.19              |       h1aa4202_0        18.9 MB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    setuptools-69.5.1          |   py38haa95532_0        1003 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    sqlite-3.45.3              |       h2bbff1b_0         973 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    vc-14.2                    |       h2eaa2aa_4          10 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    vs2015_runtime-14.29.30133 |       h43f2093_4         1.1 MB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    wheel-0.43.0               |   py38haa95532_0         137 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    ------------------------------------------------------------
                                           Total:        32.9 MB

The following NEW packages will be INSTALLED:

  ca-certificates    anaconda/pkgs/main/win-64::ca-certificates-2024.7.2-haa95532_0
  libffi             anaconda/pkgs/main/win-64::libffi-3.4.4-hd77b12b_1
  openssl            anaconda/pkgs/main/win-64::openssl-3.0.14-h827c3e9_0
  pip                anaconda/pkgs/main/win-64::pip-24.0-py38haa95532_0
  python             anaconda/pkgs/main/win-64::python-3.8.19-h1aa4202_0
  setuptools         anaconda/pkgs/main/win-64::setuptools-69.5.1-py38haa95532_0
  sqlite             anaconda/pkgs/main/win-64::sqlite-3.45.3-h2bbff1b_0
  vc                 anaconda/pkgs/main/win-64::vc-14.2-h2eaa2aa_4
  vs2015_runtime     anaconda/pkgs/main/win-64::vs2015_runtime-14.29.30133-h43f2093_4
  wheel              anaconda/pkgs/main/win-64::wheel-0.43.0-py38haa95532_0

Proceed ([y]/n)? y

输入:y


Downloading and Extracting Packages
wheel-0.43.0         | 137 KB    | ############################################################################ | 100%
vs2015_runtime-14.29 | 1.1 MB    | ############################################################################ | 100%
sqlite-3.45.3        | 973 KB    | ############################################################################ | 100%
openssl-3.0.14       | 7.8 MB    | ############################################################################ | 100%
vc-14.2              | 10 KB     | ############################################################################ | 100%
ca-certificates-2024 | 128 KB    | ############################################################################ | 100%
python-3.8.19        | 18.9 MB   | ############################################################################ | 100%
setuptools-69.5.1    | 1003 KB   | ############################################################################ | 100%
libffi-3.4.4         | 122 KB    | ############################################################################ | 100%
pip-24.0             | 2.8 MB    | ############################################################################ | 100%
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
#
# To activate this environment, use
#
#     $ conda activate jio
#
# To deactivate an active environment, use
#
#     $ conda deactivate

创建成功

查看当前共有环境目录:

conda env list
# conda environments:
#
base                  *  C:\ProgramData\Anaconda3
jio                      C:\Users\jiahao\.conda\envs\jio

进入一个虚拟环境:

conda activate jio
(jio) C:\Users\jiahao>

进入成功。

安装pytorch:

conda install pytorch==2.2.0 torchvision==0.17.0 torchaudio==2.2.0 pytorch-cuda=11.8 -c pytorch -c nvidia

卸载conda时:

解决pycharm终端不会自动跳转到虚拟环境:

第一步

第二步:右击查看文件属性

第三步:从cmd开始复制

第四步:打开pycharm的文件-设置-工具-终端-SHELL路径

第五步:重启pycharm

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

hardStudy_h

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值