阿里云镜像站使用教程
镜像栏目右上角点击搜索功能查找镜像源
换源指令
sh
pip config set global.index-url http://mirrors.aliyun.com/pypi/simple/使用阿里源时报错
sh
WARNING: The repository located at mirrors.aliyun.com is not a trusted or secure host and is being ignored. If this repository is available via HTTPS we recommend you use HTTPS instead, otherwise you may silence this warning and allow it anyway with '--trusted-host mirrors.aliyun.com'.在pip install后加上--trusted-host mirrors.aliyun.com
python、cuda、pytorch之间的版本约束
以python3.9和cuda11.8对应的torch2.0.0版本为例
linux的名称为torch-2.0.0+cu118-cp39-cp39-linux_x86_64.whl
torch-2.0.0指torch版本号cp39指python3.9linux版本名称带有linux
同理,windows的版本名称为torch-2.0.0+cu118-cp39-cp39-win_amd64.whl
| PyTorch版本 | 对应的Python |
|---|---|
| PyTorch1.0 | Python 2.7,3.5,3.6,3.7 |
| PyTorch1.1 | Python 2.7,3.5,3.6,3.7 |
| PyTorch1.2 | Python 2.7,3.5,3.6,3.7 |
| PyTorch1.3 | Python 2.7,3.5,3.6,3.7 |
| PyTorch1.4 | Python 2.7,3.5,3.6,3.7,3.8 |
| PyTorch1.5 | Python 3.5,3.6,3.7,3.8 |
| PyTorch1.6 | Python 3.5,3.6,3.7,3.8 |
| PyTorch1.7 | Python 3.5,3.6,3.7,3.8 |
| PyTorch1.8 | Python 3.6,3.7,3.8,3.9 |
| PyTorch1.9 | Python 3.6,3.7,3.8,3.9 |
| PyTorch2.0 | Python 3.8,3.9,3.10 |
| PyTorch2.1 | Python 3.8,3.9,3.10,3.11 |
| PyTorch2.2 | Python 3.8,3.9,3.10,3.11 |
| PyTorch2.3 | Python 3.10,3.11,3.12 |
| PyTorch2.4 | Python 3.10,3.11,3.12 |
| PyTorch2.5 | Python 3.9,3.10,3.11,3.12,3.13 |
python包国内下不了怎么办?
.condarc文件地址--C:\Users\用户名
.condarc文件解释--以添加清华镜像源为例
sh
# 这是 condarc 文件中用于指定 Conda 包来源通道的部分。它定义了 Conda 在查找和安装包时会优先使用的通道列表。
channels:
# 这是 Conda 默认的通道,通常指向 Anaconda 官方提供的包仓库。它包含了大部分常用的 Python 包和依赖项。
- defaults
# 这个选项用于控制 Conda 是否在输出中显示包的来源通道 URL。
# 当设置为 true 时,Conda 在安装包或列出包信息时会显示包所在的通道 URL。这有助于用户了解包的来源,便于调试和管理
show_channel_urls: true
# 这是 Conda 默认的通道列表,通常由 Anaconda 官方维护。这些通道是 Conda 在没有其他指定通道时会使用的默认包来源。
default_channels:
# 这是清华大学提供的 Anaconda 镜像,包含主通道的包。
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
# 这是针对 R 语言包的通道。
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
# 这是针对 MSYS2(一个用于 Windows 的 Unix-like 环境)的包通道。
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
# 这是用户自定义的通道配置,通常用于指定特定的包来源,比如社区维护的通道或第三方提供的通道。
custom_channels:
# 这是一个由社区维护的通道,提供大量的高质量包。这里将其指向了清华大学的镜像。
conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
# 这是 PyTorch 官方的通道,用于获取 PyTorch 相关的包。同样指向了清华大学的镜像。
pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
# 指定虚拟环境路径
envs_dirs:
- D:/Conda/envs
# 指定包环境路径
pkgs_dirs:
- D:/Conda/pkgs快捷复制版本
sh
channels:
- defaults
show_channel_urls: true
default_channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
custom_channels:
conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud清除缓存
sh
conda clean -i