一、d2l.ai学习环境的搭建
windows11 cuda13.4
先安装miniconda
https://anaconda.com/api/installers/Miniconda3-latest-Windows-x86_64.exe
.condarc
show_channel_urls: true
default_channels:
- https://mirror.nju.edu.cn/anaconda/pkgs/main
- https://mirror.nju.edu.cn/anaconda/pkgs/r
- https://mirror.nju.edu.cn/anaconda/pkgs/msys2
custom_channels:
conda-forge: https://mirror.nju.edu.cn/anaconda/cloud
pytorch: https://mirror.nju.edu.cn/anaconda/cloud
solver: rattler
channel_priority: flexible
针对d2l.ai建立单独的python虚拟环境d2lenv
conda create -n d2lenv python=3.11
conda activate d2lenv
激活d2lenv虚拟环境后,开始安装torch torchvision torchaudio
conda install pytorch torchvision torchaudio
安装完成后报这个警告
This warning means your conda environment is marked as externally managed because the new conda‑pypi plugin is installed,
and conda is informing you that PyPI packages can now be installed safely using conda install instead of pip
Why You See This Warning
Starting with conda 26.5+, the conda‑pypi plugin is included or can be enabled. When active, it installs a PEP 668 EXTERNALLY‑MANAGED marker inside environments.
This marker prevents accidental pip install calls that could break conda environments. Instead, conda shows a message like the one you received.
(d2lenv) C:\Users\lenovo>conda -V
conda 26.7.1
(d2lenv) C:\Users\lenovo>
解决方法
--不用执行这行conda install --name base "conda>=26.5" conda config --set solver rattler conda config --append channels conda-pypi conda config --set channel_priority flexible
测试安装torch等是否成功
Python 3.11.16 | packaged by Anaconda, Inc. | (main, Aug 27 2026, 14:36:16) [MSC v.1942 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import torch >>> print(torch.cuda.is_available()) True >>> print(torch.version.cuda) 13.0 >>> exit()
环境安装成功了
WARNING conda.models.version:get_matcher(564): Using .* with relational operator is superfluous and deprecated and will be removed in a future version of conda.
Your spec was 3.4.*, but conda is ignoring the .* and treating it as 3.4
报这个错误时,是因为生成了channels这个键,移除即可
conda config --remove-key channels
继续安装jupyter notebook
conda install jupyterlab
pip install jupyterlab-language-pack-zh-CN conda install notebook
jupyter notebook

全英文界面给调整成中文



-------------------------------------------------
保持专注,只做一件事,做好这件事!@
-------------------------------------------------

浙公网安备 33010602011771号