Under Linux server, Anaconda install multiple python and library files

Different development projects often require multiple versions of python and a different version of the library, this time Anaconda is a very useful tool. This article describes a case already under anaconda case of installation, how to deploy different versions of python and library files.

  1. After adding a new environment variable, where xxx is take your own name, add a new environment variable that will / anaconda3 / envs path, create a new folder xxx. python = 3.6 for the python version you need.
conda create -n xxx python=3.6

Then the software will automatically find the software library to be configured, and then ask [y] / n? Choose y, then download and install. A new name for python3.6 of xxx environment will be installed.
Here Insert Picture Description
Enter the following command to activate the environment variable

source activate xxx

Enter the following command, you can see the system in all environments

conda env list
  1. Install this environment needed libraries
    such as installing numpy
conda install --name xxx numpy

Such as installing matplotlib

conda install --name xxx matplotlib
  1. That is more than complete. More conda command as follows:
# 列出所有已安装的包
conda list
# 安装软件包,同时它会自动安装此软件包的依赖项 
conda install package_name
# 同时安装多个包
conda install numpy pandas
# 安装指定版本的包
conda install python=2.7
# 安装离线包
conda install /package-path/package-filename.tar.bz2
# 卸载包
conda remove package_name
# 更新环境中的所有已安装的包
conda update/upgrade --all
# 更新conda,保持conda最新
conda update conda
# 更新anaconda
conda update anaconda
# 更新python
conda update python
# 查看conda安装信息
conda info
# 查看conda帮助
conda help
# 搜索可以安装的包
conda search package_name
# 创建conda虚拟环境
conda create -n env_name
# 在这里,-n env_name 设置环境的名称(-n 是指名称),而 list of packages 是要安装在环境中的包的列表
conda create -n env_name list of packages
# 可以创建具有特定 Python 版本的环境
conda create -n py2.7.14 python=2.7.14
# 查看conda版本
conda -V

# 进入环境
# linux 下用 
source activate env_name
# windows 下用
activate env_name

# 离开环境
# linux 下用 
source deactivate
# windows 下用
deactivate

# 列出环境
conda env list
# 删除环境
conda env remove -n env_name
# 导出环境将包保存为 YAML,输出环境中的所有包的名称(包括 Python 版本)
conda env export > environment.yaml
# 加载环境
conda env create -f environment.yaml
Released six original articles · won praise 26 · views 80000 +

Guess you like

Origin blog.csdn.net/qq_33683032/article/details/104683060