00 - ready Anaconda environment

Anaconda

surroundings

The official download the installation package:https://www.anaconda.com/download/

Anaconda Navigtor: Kit and for managing a graphical user interface environment, many subsequent management command may be done manually directed in the Navigator.
Jupyter notebook: a web-based interactive computing environment, people can edit a document easy to read and display data for process analysis.
qtconsole: a imitation terminal IPython executable GUI program, compared Python Shell interface, qtconsole can directly display the graphic code generation, to realize the input lines of code execution, and many useful functions and built-in functions.
spyder: use a Python language, cross-platform integrated development environment for scientific computing.

You find the corresponding operating system, and then download and install to use, very convenient.

Common Commands

# 在终端执行如下命令,需要使用【管理员权限】更新所有工具库
conda upgrade --all

# 管理Python包
conda install package_name # 安装一个库
conda install numpy scipy pandas # 安装多个库
conda install numpy=1.10 # 安装一个固定版本的库
conda remove package_name # 删除一个库
conda update package_name # 更新一个库
conda list # 查看所有已经安装的库
conda search search_term # 搜索一个库

# 管理Python环境
# 默认的环境是root,你也可以创建一个新环境
# -n 代表name,env_name是需要创建的环境名称,list of packages 则是列出在新环境中需要安装的工具包。
conda create -n env_name list of packages

# 例如,当我安装了Python3版本的Anaconda后,默认的root环境自然是Python3,但是我还需要创建一个Python2的环境来运行旧版本的Python代码,最好还安装了pandas包,于是我们运行以下命令来创建:
conda create -n py2 python=2.7 pandas

conda create -n tensorflow python=3

conda create -n superset python=3

# Linux系统进入名为env_name的环境:
source activate env_name
source deactivate

# Windows系统中进入环境
activate env_name
deactivate

# 删除名为 env_name 的环境
conda env remove -n env_name

# 显示所有的环境
conda env list

# 当分享代码的时候,同时也需要将运行环境分享给大家,执行如下命令可以将当前环境下的package信息存入名为environment的YAML文件中
conda env export > environment.yaml

# 同样,当执行他人的代码时,也需要配置相应的环境.这时你可以用对方分享的YAML文件来创建一摸一样的运行环境.
conda env create -f environment.yaml

The first environment

# 创建Py3 版本的环境
conda create -n tensorflow python=3
# 激活环境
activate tensorflow
# 安装 tensorflow 相关的包
conda install tensorflow
# 安装 matplotlib 相关的包
conda install matplotlib

R & D environment (currently unused)

conda install ipykernel

activate tensorflow

python -m ipykernel install --user --name 环境名称 --display-name "Python (环境名称)"
python -m ipykernel install --user --name tensorflow --display-name "Python tensorflow"

jupyter notebook

R & D environment (being used)

# 激活 Tensorflow环境后,重新安装spyder
conda install spyder
spyder

Common package installed

# 注意先激活环境activate tensorflow
conda install -c anaconda psycopg2 # PostgreSQL 驱动包
conda install -c anaconda beautifulsoup4 # 解析网页的包
conda install -c anaconda pysocks # socks 相关包
conda install -c anaconda scikit-learn # 机器学习相关包

pip install configparser # 读取配置文件相关包

Reference Documents

Official warehouse

Guess you like

Origin www.cnblogs.com/duchaoqun/p/11951071.html