Anaconda简介及CentOS下的安装及使用
Posted 不如归去
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Anaconda简介及CentOS下的安装及使用相关的知识,希望对你有一定的参考价值。
转自:https://blog.csdn.net/Yushl_sirius/article/details/77866411
一、Anaconda简介
Anaconda是一个用于科学计算的Python发行版,支持 Linux, Mac, Windows系统,提供了包管理与环境管理的功能,可以很方便地解决多版本python并存、切换以及各种第三方包安装问题。Anaconda利用工具/命令conda
来进行package和environment的管理,并且已经包含了Python和相关的配套工具。
这里先解释下conda、anaconda这些概念的差别。conda
可以理解为一个工具,也是一个可执行命令,其核心功能是包管理与环境管理。包管理与pip的使用类似,环境管理则允许用户方便地安装不同版本的python并可以快速切换。Anaconda则是一个打包的集合,里面预装好了conda、某个版本的python、众多packages、科学计算工具等等,所以也称为Python的一种发行版。其实还有Miniconda,顾名思义,它只包含最基本的内容——python与conda,以及相关的必须依赖项,对于空间要求严格的用户,Miniconda是一种选择。
说明一下conda的设计理念——conda将几乎所有的工具、第三方包都当做package对待,甚至包括python和conda自身。因此,conda打破了包管理与环境管理的约束,能非常方便地安装各种版本python、各种package并方便地切换。
二、CentOS下的Anaconda安装
1、下载Anaconda,下载地址:https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/
以Anaconda3-4.4.0-Linux-x86_64为例,在上述站点(或者官网)将Anaconda3-4.4.0-Linux-x86_64.sh文件下载到本地,这里以下载到本地Downloads目录为例。
2、安装Anaconda
打开Linux命令行窗口(Terminal),进入Anaconda3-4.4.0-Linux-x86_64.sh所在目录,输入命令:bashAnaconda3-4.4.0-Linux-x86_64.sh,然后窗口会出现more,然后一直回车往下翻,会看到一个让你输入yes/no,输入yes回车,窗口会出现各种包install列表;然后会让你回车继续,按回车;然后过一会儿又会出现让你输入yes/no,输入yes;安装结束。
重新打开Terminal,输入命令:conda,会出现conda命令说明:
[[email protected] Downloads]$ conda
usage: conda [-h] [-V] command ...
conda is a tool for managing and deploying applications, environments and packages.
Options:
positional arguments:
command
info Display information about current conda install.
help Displays a list of available conda commands and their help
strings.
list List linked packages in a conda environment.
search Search for packages and display their information. The input
is a Python regular expression. To perform a search with a
search string that starts with a -, separate the search from
the options with --, like ‘conda search -- -h‘. A * in the
results means that package is installed in the current
environment. A . means that package is not installed but is
cached in the pkgs directory.
create Create a new conda environment from a list of specified
packages.
install Installs a list of packages into a specified conda
environment.
update Updates conda packages to the latest compatible version. This
command accepts a list of package names and updates them to
the latest versions that are compatible with all other
packages in the environment. Conda attempts to install the
newest versions of the requested packages. To accomplish
this, it may update some packages that are already installed,
or install additional packages. To prevent existing packages
from updating, use the --no-update-deps option. This may
force conda to install older versions of the requested
packages, and it does not prevent additional dependency
packages from being installed. If you wish to skip dependency
checking altogether, use the ‘--force‘ option. This may
result in an environment with incompatible packages, so this
option must be used with great caution.
upgrade Alias for conda update. See conda update --help.
remove Remove a list of packages from a specified conda environment.
uninstall Alias for conda remove. See conda remove --help.
config Modify configuration values in .condarc. This is modeled
after the git config command. Writes to the user .condarc
file (/home/sirius/.condarc) by default.
clean Remove unused packages and caches.
package Low-level conda package utility. (EXPERIMENTAL)
optional arguments:
-h, --help Show this help message and exit.
-V, --version Show the conda version number and exit.
other commands, such as "conda build", are available when additional conda
packages (e.g. conda-build) are installed
输入命令:conda list,可以查看Anaconda管理的所有包:
三、Anaconda的使用
1、因为Anaconda.org的服务器在国外,所以需要安装packages时,你会发现conda下载的速度经常很慢,所幸清华TUNA镜像源有Anaconda仓库的镜像,我们将其加入conda的配置即可:
2、启动Python IDE Spyder:
在命令窗口直接输入spyder,系统会自动启动spyder3。
3、常用的conda命令:
1)、 查看当前环境下已安装的包:conda list
2)、查找package信息:conda search XXXX (XXXX为你要查找的包名称)
3)、安装package :conda install -n XXXX(环境名称) XXXX(要安装的package名称)
以上是关于Anaconda简介及CentOS下的安装及使用的主要内容,如果未能解决你的问题,请参考以下文章