参考:
Ubuntu20+Miniconda3+Python3 安装配置环境(手动添加环境变量,更换清华源)_ubuntu miniconda添加环境变量-优快云博客
Index of /anaconda/miniconda/ | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror
Index of /anaconda/archive/ | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror
Windows 11 搭建GPU版本PyTorch环境详细过程-优快云博客
安装Miniconda:
Miniconda3 will now be installed into this location:
/root/miniconda3
Miniconda3 will now be installed into this location:
/root/miniconda3
-----------------------------------------------------------------------------------
Do you wish to update your shell profile to automatically initialize conda?
This will activate conda on startup and change the command prompt when activated.
If you'd prefer that conda's base environment not be activated on startup,
run the following command when conda is activated:
conda config --set auto_activate_base false
You can undo this by running `conda init --reverse $SHELL`? [yes|no]
[no] >>> yes
no change /root/miniconda3/condabin/conda
no change /root/miniconda3/bin/conda
no change /root/miniconda3/bin/conda-env
no change /root/miniconda3/bin/activate
no change /root/miniconda3/bin/deactivate
no change /root/miniconda3/etc/profile.d/conda.sh
no change /root/miniconda3/etc/fish/conf.d/conda.fish
no change /root/miniconda3/shell/condabin/Conda.psm1
no change /root/miniconda3/shell/condabin/conda-hook.ps1
no change /root/miniconda3/lib/python3.12/site-packages/xontrib/conda.xsh
no change /root/miniconda3/etc/profile.d/conda.csh
modified /root/.bashrc
==> For changes to take effect, close and re-open your current shell. <==
Thank you for installing Miniconda3!
重启bash并测试:

安装pytorch + cuda:
conda create -n sd python=3.10
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121 -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager, possibly rendering your system unusable.It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv. Use the --root-user-action option if you know what you are doing and want to suppress this warning.
验证pytorch环境:
import torch
torch.cuda.is_available()
安装jupyter notebook:
/root/miniconda3/envs/sd/bin/pip3 install jupyter -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
启动jupyter notebook:
jupyter notebook --allow-root
786

被折叠的 条评论
为什么被折叠?



