pip与conda换国内源

好的,以下是 pipconda 通过命令行换源的方法:

📦 pip 换源

  1. 临时使用镜像源

    在安装包时直接指定源:

    bash 复制代码
    pip install <包名> -i https://pypi.tuna.tsinghua.edu.cn/simple
  2. 永久配置镜像源

    通过命令修改默认源配置:

    bash 复制代码
    pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

🐍 conda 换源

  1. 添加清华源

    依次执行以下命令:

    bash 复制代码
    conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
    conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r/
    conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
  2. 设置搜索时显示通道地址

    bash 复制代码
    conda config --set show_channel_urls yes
  3. 查看当前配置

    bash 复制代码
    conda config --show

⚠ 注意事项

  1. 镜像源地址需根据网络环境选择(如清华、阿里云等)
  2. 执行后可通过 pip config listconda config --show 验证配置
  3. 某些镜像可能存在同步延迟,若失败可尝试其他源

提示:替换后建议运行 pip cache purgeconda clean -i 清除旧索引缓存。

相关推荐
ricky_fan9 小时前
(OpenAI)Codex 安装、部署使用方式
python·macos·conda·vim
YMWM_1 天前
‘pip install -e .‘ and ‘pip install .‘
pip·pip install
請你喝杯Java2 天前
Python 后端开发:从虚拟环境、pip、requirements.txt 到项目启动
开发语言·python·pip
Hello.Reader2 天前
PySpark 安装保姆级教程pip、Conda、手动安装、Spark Connect 一次讲透(一)
python·spark·conda·pip
Python大数据分析@2 天前
Python包管理器 uv是否替代conda?
python·conda·uv
N盒2 天前
【WhisperX+M2M100】快速视频转字幕工具
python·pip
万里沧海寄云帆2 天前
一步修复Win11下conda无法激活问题
linux·python·conda
波特率1152002 天前
miniconda入门使用
python·conda·miniconda·python环境
好好学习叭~3 天前
将conda环境打包为docker镜像
docker·容器·conda
on_pluto_4 天前
论文GAN(GRAPH ATTENTION NETWORKS)阅读笔记
服务器·人工智能·pytorch·conda