一、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
Anaconda3-4.4.0-Linux-x86_64.sh,然后窗口会出现more,然后一直回车往下翻,会看到一个让你输入yes/no,输入yes回车,窗口会出现各种包install列表;然后会让你回车继续,按回车;然后过一会儿又会出现让你输入yes/no,输入yes;安装结束。
注意需要执行:source ~/.bashrc 环境变量生效才可以!!!
重新打开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管理的所有包:
# packages in environment at /home/sirius/anaconda3:
#
_license 1.1 py36_1
alabaster 0.7.10 py36_0
anaconda 4.4.0 np112py36_0
anaconda-client 1.6.3 py36_0
anaconda-navigator 1.6.2 py36_0
anaconda-project 0.6.0 py36_0
asn1crypto 0.22.0 py36_0
astroid 1.4.9 py36_0
astropy 1.3.2 np112py36_0
babel 2.4.0 py36_0
backports 1.0 py36_0
beautifulsoup4 4.6.0 py36_0
bitarray 0.8.1 py36_0
blaze 0.10.1 py36_0
bleach 1.5.0 py36_0
bokeh 0.12.5 py36_1
boto 2.46.1 py36_0
bottleneck 1.2.1 np112py36_0
cairo 1.14.8 0
cffi 1.10.0 py36_0
chardet 3.0.3 py36_0
click 6.7 py36_0
cloudpickle 0.2.2 py36_0
clyent 1.2.2 py36_0
colorama 0.3.9 py36_0
conda 4.3.21 py36_0
conda-env 2.6.0 0
contextlib2 0.5.5 py36_0
cryptography 1.8.1 py36_0
curl 7.52.1 0
cycler 0.10.0 py36_0
cython 0.25.2 py36_0
cytoolz 0.8.2 py36_0
dask 0.14.3 py36_1
datashape 0.5.4 py36_0
dbus 1.10.10 0
decorator 4.0.11 py36_0
distributed 1.16.3 py36_0
docutils 0.13.1 py36_0
entrypoints 0.2.2 py36_1
et_xmlfile 1.0.1 py36_0
expat 2.1.0 0
fastcache 1.0.2 py36_1
flask 0.12.2 py36_0
flask-cors 3.0.2 py36_0
fontconfig 2.12.1 3
freetype 2.5.5 2
get_terminal_size 1.0.0 py36_0
gevent 1.2.1 py36_0
glib 2.50.2 1
greenlet 0.4.12 py36_0
gst-plugins-base 1.8.0 0
gstreamer 1.8.0 0
h5py 2.7.0 np112py36_0
harfbuzz 0.9.39 2
hdf5 1.8.17 1
heapdict 1.0.0 py36_1
html5lib 0.999 py36_0
icu 54.1 0
idna 2.5 py36_0
imagesize 0.7.1 py36_0
ipykernel 4.6.1 py36_0
ipython 5.3.0 py36_0
ipython_genutils 0.2.0 py36_0
ipywidgets 6.0.0 py36_0
isort 4.2.5 py36_0
itsdangerous 0.24 py36_0
jbig 2.1 0
jdcal 1.3 py36_0
jedi 0.10.2 py36_2
jinja2 2.9.6 py36_0
jpeg 9b 0
jsonschema 2.6.0 py36_0
jupyter 1.0.0 py36_3
jupyter_client 5.0.1 py36_0
jupyter_console 5.1.0 py36_0
jupyter_core 4.3.0 py36_0
lazy-object-proxy 1.2.2 py36_0
libffi 3.2.1 1
libgcc 4.8.5 2
libgfortran 3.0.0 1
libiconv 1.14 0
libpng 1.6.27 0
libsodium 1.0.10 0
libtiff 4.0.6 3
libtool 2.4.2 0
libxcb 1.12 1
libxml2 2.9.4 0
libxslt 1.1.29 0
llvmlite 0.18.0 py36_0
locket 0.2.0 py36_1
lxml 3.7.3 py36_0
markupsafe 0.23 py36_2
matplotlib 2.0.2 np112py36_0
mistune 0.7.4 py36_0
mkl 2017.0.1 0
mkl-service 1.1.2 py36_3
mpmath 0.19 py36_1
msgpack-python 0.4.8 py36_0
multipledispatch 0.4.9 py36_0
navigator-updater 0.1.0 py36_0
nbconvert 5.1.1 py36_0
nbformat 4.3.0 py36_0
networkx 1.11 py36_0
nltk 3.2.3 py36_0
nose 1.3.7 py36_1
notebook 5.0.0 py36_0
numba 0.33.0 np112py36_0
numexpr 2.6.2 np112py36_0
numpy 1.12.1 py36_0
numpydoc 0.6.0 py36_0
odo 0.5.0 py36_1
olefile 0.44 py36_0
openpyxl 2.4.7 py36_0
openssl 1.0.2l 0
packaging 16.8 py36_0
pandas 0.20.1 np112py36_0
pandocfilters 1.4.1 py36_0
pango 1.40.3 1
partd 0.3.8 py36_0
path.py 10.3.1 py36_0
pathlib2 2.2.1 py36_0
patsy 0.4.1 py36_0
pcre 8.39 1
pep8 1.7.0 py36_0
pexpect 4.2.1 py36_0
pickleshare 0.7.4 py36_0
pillow 4.1.1 py36_0
pip 9.0.1 py36_1
pixman 0.34.0 0
ply 3.10 py36_0
prompt_toolkit 1.0.14 py36_0
psutil 5.2.2 py36_0
ptyprocess 0.5.1 py36_0
py 1.4.33 py36_0
pycosat 0.6.2 py36_0
pycparser 2.17 py36_0
pycrypto 2.6.1 py36_6
pycurl 7.43.0 py36_2
pyflakes 1.5.0 py36_0
pygments 2.2.0 py36_0
pylint 1.6.4 py36_1
pyodbc 4.0.16 py36_0
pyopenssl 17.0.0 py36_0
pyparsing 2.1.4 py36_0
pyqt 5.6.0 py36_2
pytables 3.3.0 np112py36_0
pytest 3.0.7 py36_0
python 3.6.1 2
python-dateutil 2.6.0 py36_0
pytz 2017.2 py36_0
pywavelets 0.5.2 np112py36_0
pyyaml 3.12 py36_0
pyzmq 16.0.2 py36_0
qt 5.6.2 4
qtawesome 0.4.4 py36_0
qtconsole 4.3.0 py36_0
qtpy 1.2.1 py36_0
readline 6.2 2
requests 2.14.2 py36_0
rope 0.9.4 py36_1
ruamel_yaml 0.11.14 py36_1
scikit-image 0.13.0 np112py36_0
scikit-learn 0.18.1 np112py36_1
scipy 0.19.0 np112py36_0
seaborn 0.7.1 py36_0
setuptools 27.2.0 py36_0
simplegeneric 0.8.1 py36_1
singledispatch 3.4.0.3 py36_0
sip 4.18 py36_0
six 1.10.0 py36_0
snowballstemmer 1.2.1 py36_0
sortedcollections 0.5.3 py36_0
sortedcontainers 1.5.7 py36_0
sphinx 1.5.6 py36_0
spyder 3.1.4 py36_0
sqlalchemy 1.1.9 py36_0
sqlite 3.13.0 0
statsmodels 0.8.0 np112py36_0
sympy 1.0 py36_0
tblib 1.3.2 py36_0
terminado 0.6 py36_0
testpath 0.3 py36_0
tk 8.5.18 0
toolz 0.8.2 py36_0
tornado 4.5.1 py36_0
traitlets 4.3.2 py36_0
unicodecsv 0.14.1 py36_0
unixodbc 2.3.4 0
wcwidth 0.1.7 py36_0
werkzeug 0.12.2 py36_0
wheel 0.29.0 py36_0
widgetsnbextension 2.0.0 py36_0
wrapt 1.10.10 py36_0
xlrd 1.0.0 py36_0
xlsxwriter 0.9.6 py36_0
xlwt 1.2.0 py36_0
xz 5.2.2 1
yaml 0.1.6 0
zeromq 4.1.5 0
zict 0.1.2 py36_0
zlib 1.2.8 3
三、Anaconda的使用
1、因为Anaconda.org的服务器在国外,所以需要安装packages时,你会发现conda下载的速度经常很慢,所幸清华TUNA镜像源有Anaconda仓库的镜像,我们将其加入conda的配置即可:
# 添加Anaconda的TUNA镜像
conda
config
--
add
channels
https
:
//mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
# 设置搜索时显示通道地址
conda
config
--
set
show_channel_urls
yes
2、启动Python IDE Spyder:
在命令窗口直接输入spyder,系统会自动启动spyder3。
3、常用的conda命令:
查看当前环境下已安装的包:conda list
查找package信息:conda search XXXX (XXXX为你要查找的包名称)
安装package :conda install -n XXXX(环境名称) XXXX(要安装的package名称)
# 如果不用-n指定环境名称,则被安装在当前活跃环境
# 也可以通过-c指定通过某个channel安装
4)、更新package :conda update - n XXXX(环境名称) XXXX(要更新的package名称)
5)、删除package :conda remove - n XXXX(环境名称) XXXX(要更新的package名称)
问题:
PREFIX=/root/anaconda3
tar (child): bzip2:无法 exec: 没有那个文件或目录
解决:
yum install -y bzip2
标签:np112py36,CentOS,package,简介,py36,conda,Anaconda,packages From: https://blog.51cto.com/u_16091571/6233825