环境准备
工具介绍
在使用python过程中, 我们经常需要安装一些第三方库,经常会用到pip来安装第三方库。 但是pip安装的库,一般都是安装在python的安装目录下,有时候我们并不想安装在python的安装目录下,使用虚拟环境进行隔离,减少依赖的冲突。 那么我们就需要使用Miniconda来安装第三方库,他可以创建一个虚拟环境,我们可以在虚拟环境下安装第三方库,这样我们就可以避免安装在python安装目录中。
pip优势 | Miniconda优势 |
---|---|
安装python模块 | 安装python模块 非python模块 |
- | 创建、加载等虚拟环境 |
卸载模块时,不清理依赖 | 卸载模块,清理依赖 |
安装Miniconda
下载安装包
shell
https://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda/?C=M&O=D # 清华镜像
根据时间倒序,选择自身系统对应版本的安装包进行下载
设置镜像
shell
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/free
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
安装pycharm
下载安装包
shell
https://www.jetbrains.com/pycharm/download/#section=windows
运行
创建环境
shell
conda create -n wk312 python=3.12 # wk312为环境名称 python=3.12 为python版本
查看效果