pip与conda换国内源

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

📦 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 list 或 conda config --show 验证配置
  3. 某些镜像可能存在同步延迟,若失败可尝试其他源

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

相关推荐
SoulRoar.3 天前
WSL2 + Conda 环境下MinerU 4.x GPU 服务部署与 systemd 常驻指南
conda·wsl·文档解析·mineru
沧海一笑-dj5 天前
【Python】Python学习笔记-模块与包
python·pip·模块·包·python包·python模块·包与模块
郝学胜-神的一滴7 天前
AI 编程智能体 16:从零基础搭建到精细化优化
人工智能·python·算法·语言模型·langchain·pip
万粉变现经纪人9 天前
如何解决 pip install 安装报错 检测到 yanked 版本需更换可用版本 问题
人工智能·python·scrapy·numpy·pandas·pyqt·pip
jiangliushi611 天前
GPT-6.1 Sol 免费用:pip install 太慢、超时?换清华镜像,再让 Codex 帮你写脚本
gpt·pip
看我debug14 天前
Android 运行时分析工作台 (Demo)。统一管理 Frida 脚本、自动注入(修改运行时代码)、收集结构化结果、生成 JSON 报告。
android·python·pip
benjiangliu15 天前
恩培趣味计算机视觉-01-conda环境和Python库
开发语言·python·conda
weixin_4617694019 天前
conda create 创建容器 Failed to resolve ‘repo.anaconda.com‘问题
开发语言·python·conda·repo·网络问题·无法创建
饭来_23 天前
Ubuntu 中出现 CondaToSNonInteractiveError 的解决方法
ubuntu·conda·debug
emo_2b25 天前
Pycharm配置conda解释器时遇到的问题及解决方法
linux·pycharm·conda