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

相关推荐
YelloooBlue15 小时前
深度学习 SOP: conda通过命令快速构建指定版本tensorflow gpu环境。
深度学习·conda·tensorflow
小舞O_o1 天前
CondaError: Run ‘conda init‘ before ‘conda activate‘
linux·python·conda
Java后端的Ai之路1 天前
【Python小知识】-pip install xxx 命令安装的 ,在电脑的哪个盘?
开发语言·python·pip·pip install
Clarice__2 天前
Anaconda安装、使用教程
windows·python·机器学习·conda·visual studio code
gsgbgxp2 天前
安装库是优先用conda还是pip
深度学习·ubuntu·conda·pip
玄同7653 天前
深入理解 SQLAlchemy 的 relationship:让 ORM 关联像 Python 对象一样简单
人工智能·python·sql·conda·fastapi·pip·sqlalchemy
chinesegf3 天前
Windows 系统中通过 Conda 「克隆」环境
windows·conda
和小胖11223 天前
Anaconda虚拟环境创建步骤
python·conda·numpy
gs801403 天前
记录一次部署踩坑:Conda 环境导致 yum 报错与 LibreOffice 安装指南
conda
好好学习啊天天向上3 天前
C盘容量不够,python , pip,安装包的位置
linux·python·pip