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 清除旧索引缓存。

相关推荐
咯哦哦哦哦12 小时前
Foundationpose环境配置【非conda--纯UV】(linux22.04+python3.10)
python·pip·uv
nashane1 天前
HarmonyOS 6学习:画中画(PiP)状态同步与场景化实战指南
学习·pip·harmonyos·harmonyos 5
Mr.朱鹏2 天前
【Python 进阶 | 第四篇】Psycopg3 + Flask 实现 PostgreSQL CRUD 全流程:从连接池到RESTful接口
python·postgresql·flask·virtualenv·fastapi·pip·tornado
独隅3 天前
Anaconda被误删后抢救手册
conda
矢志航天的阿洪3 天前
手动安装Gurobi并配置gurobipy到Python环境(Windows/Conda)
windows·python·conda
万粉变现经纪人4 天前
如何解决 pip install bitsandbytes 报错 仅支持 Linux+glibc(macOS/Windows 失败)问题
linux·运维·windows·python·scrapy·macos·pip
GL_Rain4 天前
conda通过environment.yml创建虚拟环境(指定路径)报错解决教程
conda
雕刻刀6 天前
linux中复制conda环境
linux·python·conda
乐园游梦记7 天前
在pycharm中添加Conda创建的openmmlab虚拟环境作为解释器
ide·pycharm·conda
贵沫末7 天前
Python——图像处理项目Conda环境搭建
开发语言·python·conda