创建Anaconda环境与安装/卸载/更新包(可控制python版本,安装包版本等)
1.打开Anaconda prompt(注意不是Anaconda Powershell Prompt)
2.创建环境:
conda create --name xxx python=3.6
// xxx是你要创建的环境的名字
// python=后面的3.6是你要在这个环境中使用的python的版本
3.启动环境:
activate xxx
// xxx为你刚刚创建的环境名,现在我们启动这个环境吧!
(可选)4.引用tuna清华镜像(加速部分包的下载速度)
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/main/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
conda config --set show_channel_urls yes
// conda config --add channels:通过向C:\Users\admin中添加.condarc文件来使用tuna源进行加速!
// conda config --set show_channel_urls yes:并没有实际性作用,它只是让我们日后下载包的时候能够看到包的下载来源。
5.安装/卸载/更新包(控制版本):
conda install xxx
conda remove xxx
conda update xxx
// xxx是需要进行操作的包名
// conda是我们使用的安装器
// 除了conda,我们还有pip这样的安装器,也就是有时候如下代码也可以使用:
// remove命令可以用uninstall替换如:conda uninstall xxx
pip install xxx
pip remove xxx
pip update xxx
// 如果想要控制安装包的版本,则使用如下语句
// yyy是版本,实例见如下第二、三行
pip install xxx==yyy
pip install numpy==1.19.5
conda install mkl-service==2.3.0