1.使用 pip 命令指定源(AAA替换为你要安装的库)
python
# 清华 PyPI 源
pip install AAA -i https://pypi.tuna.tsinghua.edu.cn/simple
# 阿里云 PyPI 源(速度也很快)
pip install AAA -i https://mirrors.aliyun.com/pypi/simple/
# 豆瓣源(备用)
pip install AAA -i https://pypi.douban.com/simple/
2.使用 conda 命令指定源
python
# 示例:安装 opencv-contrib-python,指定清华镜像源
conda install -c https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ opencv-contrib-python
# 安装 pytorch,指定清华源(解决官方源慢的问题)
conda install -c https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/ pytorch torchvision torchaudio
# 安装常用库(如 numpy、ffmpeg)
conda install -c https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/ numpy ffmpeg