轉自:https://blog.csdn.net/Yushl_sirius/article/details/77866411python
1、Anaconda簡介git
Anaconda是一個用於科學計算的Python發行版,支持 Linux, Mac, Windows系統,提供了包管理與環境管理的功能,能夠很方便地解決多版本python並存、切換以及各類第三方包安裝問題。Anaconda利用工具/命令conda
來進行package和environment的管理,而且已經包含了Python和相關的配套工具。express
這裏先解釋下conda、anaconda這些概念的差異。conda
能夠理解爲一個工具,也是一個可執行命令,其核心功能是包管理與環境管理。包管理與pip的使用相似,環境管理則容許用戶方便地安裝不一樣版本的python並能夠快速切換。Anaconda則是一個打包的集合,裏面預裝好了conda、某個版本的python、衆多packages、科學計算工具等等,因此也稱爲Python的一種發行版。其實還有Miniconda,顧名思義,它只包含最基本的內容——python與conda,以及相關的必須依賴項,對於空間要求嚴格的用戶,Miniconda是一種選擇。bash
說明一下conda的設計理念——conda將幾乎全部的工具、第三方包都當作package對待,甚至包括python和conda自身。所以,conda打破了包管理與環境管理的約束,能很是方便地安裝各類版本python、各類package並方便地切換。服務器
2、CentOS下的Anaconda安裝app
一、下載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目錄爲例。ui
二、安裝Anacondathis
打開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;安裝結束。url
從新打開Terminal,輸入命令:conda,會出現conda命令說明:
[sirius@localhost 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管理的全部包:
3、Anaconda的使用
一、由於Anaconda.org的服務器在國外,因此須要安裝packages時,你會發現conda下載的速度常常很慢,所幸清華TUNA鏡像源有Anaconda倉庫的鏡像,咱們將其加入conda的配置便可:
二、啓動Python IDE Spyder:
在命令窗口直接輸入spyder,系統會自動啓動spyder3。
三、經常使用的conda命令:
1)、 查看當前環境下已安裝的包:conda list
2)、查找package信息:conda search XXXX (XXXX爲你要查找的包名稱)
3)、安裝package :conda install -n XXXX(環境名稱) XXXX(要安裝的package名稱)