miniconda安装和使用

摘要:
Preparingtr

一、下载和安装:

1、下载:[root@localhost ~]# wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh

2、安装:

[root@localhost ~]# chmod +x Miniconda3-latest-Linux-x86_64.sh

[root@localhost ~]# ./Miniconda3-latest-Linux-x86_64.sh

...

yaml pkgs/main/linux-64::yaml-0.1.7-had09818_2
zlib pkgs/main/linux-64::zlib-1.2.11-h7b6447c_3

Preparing transaction: done
Executing transaction: done
installation finished.
Do you wish the installer to initialize Miniconda3
by running conda init? [yes|no]
[no] >>> yes
no change /root/miniconda3/condabin/conda
no change /root/miniconda3/bin/conda
no change /root/miniconda3/bin/conda-env
no change /root/miniconda3/bin/activate
no change /root/miniconda3/bin/deactivate
no change /root/miniconda3/etc/profile.d/conda.sh
no change /root/miniconda3/etc/fish/conf.d/conda.fish
no change /root/miniconda3/shell/condabin/Conda.psm1
no change /root/miniconda3/shell/condabin/conda-hook.ps1
no change /root/miniconda3/lib/python3.8/site-packages/xontrib/conda.xsh
no change /root/miniconda3/etc/profile.d/conda.csh
modified /root/.bashrc

==> For changes to take effect, close and re-open your current shell. <==

If you'd prefer that conda's base environment not be activated on startup,
set the auto_activate_base parameter to false:

conda config --set auto_activate_base false #若是启动时不需要激活miniconda的基础环境,可设置auto_activate_base参数为false

Thank you for installing Miniconda3!

二、conda的使用

1、查看版本:

(base) [root@localhost ~]# conda --version
conda 4.8.3

2、添加清华镜像仓库:

(base) [root@localhost ~]# conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
(base) [root@localhost ~]# conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
(base) [root@localhost ~]# conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
(base) [root@localhost ~]# conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/
(base) [root@localhost ~]# conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/menpo/
(base) [root@localhost ~]# conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
3、查看下载源:

(base) [root@localhost ~]# conda config --show-sources
==> /root/.condarc <==
channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/menpo/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
- defaults

4、设置搜索时显示通道地址:

(base) [root@localhost ~]# conda config --set show_channel_urls yes

5、创建并激活一个环境:

(base) [root@localhost ~]# conda create --name python #创建名称为python的环境
Collecting package metadata (current_repodata.json): done
Solving environment: done

==> WARNING: A newer version of conda exists. <==
current version: 4.8.3
latest version: 4.8.5

Please update conda by running

$ conda update -n base -c defaults conda

## Package Plan ##

environment location: /root/miniconda3/envs/python

Proceed ([y]/n)?
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
#
# To activate this environment, use
#
# $ conda activate python
#
# To deactivate an active environment, use
#
# $ conda deactivate

python环境的安装位置在:/root/miniconda3/envs/python

安装环境并制定python版本的命令:conda create --namepythonpython=3.6

(base) [root@localhost ~]# conda create --name python2 python=2.7 #安装名称为python2的版本号为2.7的python环境
Collecting package metadata (current_repodata.json): done
Solving environment: done

==> WARNING: A newer version of conda exists. <==
current version: 4.8.3
latest version: 4.8.5

Please update conda by running

$ conda update -n base -c defaults conda

## Package Plan ##

environment location: /root/miniconda3/envs/python2

added / updated specs:
- python=2.7

The following packages will be downloaded:

...

Preparing transaction: done
Verifying transaction: done
Executing transaction: done
#
# To activate this environment, use
#
# $ conda activate python2
#
# To deactivate an active environment, use
#
# $ conda deactivate

激活python2环境:

(base) [root@localhost ~]# conda activate python2

列出所有环境:
(python2) [root@localhost ~]# conda info -e #或者condaenvlist
# conda environments:
#
base /root/miniconda3
python /root/miniconda3/envs/python
python2 * /root/miniconda3/envs/python2

6、退出环境:

(python2) [root@localhost ~]# conda deactivate

7、移除python2下的软件包zlib:

(base) [root@localhost ~]# conda remove -n python2 zlib

8、移除python2环境:

(base) [root@localhost ~]# conda remove -n python2 --all

Remove all packages in environment /root/miniconda3/envs/python2:

## Package Plan ##

environment location: /root/miniconda3/envs/python2

The following packages will be REMOVED:

_libgcc_mutex-0.1-conda_forge
...
zlib-1.2.11-h516909a_1009

Proceed ([y]/n)? y

Preparing transaction: done
Verifying transaction: done
Executing transaction: done
(base) [root@localhost ~]#

或者:

(base) [root@localhost ~]# conda env remove -n python

Remove all packages in environment /root/miniconda3/envs/python:

免责声明:文章转载自《miniconda安装和使用》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇jQuery(一)IIS部署下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

centos7安装python 与卸载python

安装python 下载Python安装包 1 cd /usr/local/src 编译时要提前装好gcc编译器和zlib zlib-devel 1、下载文件 1 wget https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz 2、解压 1 tar -zxvf Python-3.6.0...

Cypress web自动化36-cy.exec()执行python查询数据库获取结果(json数据转object对象)

前言 cy.exec() 可以执行系统命令行,那么用 python 写个查询 sql 的时候,返回结果是 json 格式。 cypress 的脚本是 javascript 语言写的,没法直接识别python返回的数据,需用 JSON 解析成 object 对象。 解决思路 遇到场景: 写自动化用例的时候,需要准备测试数据,有些数据是需要动态从数据库中读取,...

tcp与http协议 以及python的实现

htpp协议Rquest Headers格式: 请求方法空格URL空格协议版本回车符换行符 头部字段名:值回车符换行符 ··· 头部字段名:值回车符换行符 回车符换行符 请求数据 socket网络聊天 服务端 #sokcet服务断 importsocket importthreading server =socket.socket() #绑定到0.0.0....

Python什么是二次开发的意义?python在.net项目采用

任何人都知道python在.net该项目是做什么的啊? 辅助用途,用作“二次开发”。.net站点的话python主要是CGI才用。能够用python编写B/S程序。 解释一下二次开发: 对于Python来说。他本身未定义主函数 , 和LUA一样,他们都是解释语言,须要一个拥有主函数的主语言帮助解释。那么不管是在C/C++/JAVA/C#中都是一样...

Mac下Pycharm中升级pip失败,通过终端升级pip

使用 Pycharm 使,需要下载相关的第三方包,结果提示安装失败,提示要升级 pip 版本,但是通过 Pycharm 重新安装却失败,原因可能是出在通过 Pycharm 时升级 pip 是没有权限的,所以一般在 Pycharm 中升级的时候会失败。如图所示,当点击右边新版本升级的时候,一般不会成功,这个时候我们通过命令行来解决。  打开终端,在终端输入...

python测试算法运行时间函数

1、计算程序运行的时间函数(python版本)import timedef cal_time(func): def wrapper(*args,**kwargs): t1=time.perf_counter() result=func(*args,**kwargs) t2=time.perf_counter(...