欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 科技 > 名人名企 > miniconda安装教程以及pip换源【Windows版本】

miniconda安装教程以及pip换源【Windows版本】

2025/6/2 1:02:59 来源:https://blog.csdn.net/weixin_42951763/article/details/139782339  浏览:    关键词:miniconda安装教程以及pip换源【Windows版本】

Anaconda包含内容较多,这边采用miniconda进行安装演示。

下载安装包

官网链接:https://docs.anaconda.com/miniconda/

蓝奏云加速链接:https://wwt.lanzoue.com/i6ts3225vuef

开始安装

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

配置conda

在Windows开始菜单中,找到刚安装的程序并打开。
在这里插入图片描述

配置conda源

清华源官网:https://mirrors.tuna.tsinghua.edu.cn/help/anaconda/

  1. 生成.condarc文件,在Anaconda Prompt,输入以下命令生成.condarc文件:
    conda config --set show_channel_urls yes
    在这里插入图片描述
    执行后,会在用户目录下生成一个.condarc文件
    在这里插入图片描述
  2. 将下面代码复制到.condarc文件中,其中最后两行作用是修改默认conda创建环境的路径。
channels:- defaults
show_channel_urls: true
default_channels:- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
custom_channels:conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloudmsys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloudbioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloudmenpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloudpytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloudpytorch-lts: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloudsimpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/clouddeepmodeling: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/
envs_dirs:- D:\ProgramData\miniconda3\envs

在这里插入图片描述

  1. 保存文件后,在命令窗口执行命令conda clean -i清除索引缓存,保证用的是镜像站提供的索引。
    在这里插入图片描述
  2. 需要给conda环境创建路径修改权限
    在这里插入图片描述
    在这里插入图片描述

conda环境操作

创建conda环境

conda create -n python3.8 python=3.8

在这里插入图片描述

激活环境

conda activate python3.8

在这里插入图片描述

查看conda环境

由于前面在.condarc文件中修改了默认安装路径,下图即可验证安装的路径。

conda info -e

在这里插入图片描述

卸载conda环境

conda remove -n test --all

在这里插入图片描述

配置pip

修改pip源

pip源参考博客:https://blog.csdn.net/qq_41375318/article/details/106895836

# 清华源【全局配置方式】
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

在这里插入图片描述

pip install安装的路径修改

pip路径修改参考博客:https://blog.csdn.net/stone9528/article/details/127321034
如果是使用conda创建的虚拟环境,则可以在环境的路径下找到site.py文件。使用其他方式安装的同理,需要找到site.py文件。
在这里插入图片描述
打开文件后,搜索USER_SITE约在88行。
在这里插入图片描述

USER_SITE 表示安装路径
USER_BASE 表示执行下载的pip等脚本的路径
# 我的修改如下
USER_SITE = "D:\ProgramData\miniconda3\envs\python3.8\Lib\site-packages"
USER_BASE = "D:\ProgramData\miniconda3\envs\python3.8\Scripts"

在这里插入图片描述
保存退出即可完成修改。使用以下命令查看修改结果

python -m site

在这里插入图片描述

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

热搜词