Windows 10 installed and used in Anaconda

1 Anaconda Introduction

  Anaconda refers to is an open source Python release, which contains conda, Python and more than 180 scientific package and its dependencies, such as numpy, pandas. Because it contains a large number of scientific package, download the file Anaconda relatively large (approximately 531 MB), if only need some packages, or need to conserve bandwidth or storage space can also be used Miniconda this small release (and only contain conda Python).
  ** conda package is an open source environment manager can be used to install different versions of packages and their dependence on the same machine, and can be switched between different environments. ** Here is the Anaconda Download .

1.1 Anaconda features

Anaconda has the following characteristics:

  • Open source
  • Simple installation process
  • High performance language Python and R
  • Free community support
  • It features mainly based on the realization owned by Anaconda:
    • conda package
    • Environmental Manager
    • 1,000+ open source library

  If the daily work or study and unnecessary use of more than 1,00 library, consider installing Miniconda (GUI and command-line installation please download stamp), but more here describes the installation and use of Miniconda. But the proposal is still installed Anaconda, very convenient.

1.2 Anaconda, the difference conda, pip, virtualenv of

  • Anaconda is a scientific package contains 180+ and dependent release item. Science comprising package includes: conda, numpy, scipy, ipython notebook and the like.
  • conda
    • conda is the package and its dependencies and environmental management tools.
    • Applicable languages: Python, R, Ruby, Lua, Scala, Java, JavaScript, C / C ++, FORTRAN.
    • Application platform: Windows, macOS, Linux
    • use:
      • Quick to install, run and upgrade packages and their dependencies.
      • Easily created in the computer, save, load and switching environment. (If you need a package requires a different version of Python, you do not need to switch to a different environment, because conda is also an environmental manager. Need only a few commands, you can create a completely separate environment to run different versions of Python, while continuing to use your favorite Python version .-- conda official website in your normal environment)
      • conda for Python projects created, but can be applied to the above-mentioned languages
      • conda package and environment manager is included in all versions of Anaconda them.
  • pip
    • pip for mounting and package management package manager.
    • pip written languages: Python.
    • Python version installed by default:
      • Python 2.7.9 and later: default installation, command pip
      • Python 3.4 and later: default installation, the command is pip3
    • The origin of the name of the pip: pip uses a recursive acronym naming. Its name was widely believed at from 2:
      • "Pip installs Packages" ( "pip installation package")
      • "Pip installs Python" ( "pip install Python")
  • virtualenv
    • virtualenv: create a stand-alone tool for Python environment.
    • Solve the problem:
      • When a program requires Python 2.7 version, and another program requires Python 3.6 version, how to use both programs?
      • If all programs are installed in the default path of the system, such as: /usr/lib/python2.7/site-packages, when accidentally upgrade should not upgrade program will affect other programs.
      • If you want to install the program and modify its repository or library in a program is running, it will result in interruption of the program.
      • When shared hosting, the package can not be installed in the global site-packages directory.
    • virtualenv will create its own installation directory environment, which is not shared with other libraries virtualenv environment; but also can not be selectively connected to the global library installed.

2 Anaconda installation

Go to the official website to download the installation package, according to the python version and PC version of choice.
Here Insert Picture Description
Once you have downloaded the installation package, click the installation package to start the installation,
Here Insert Picture Description
Here Insert Picture Description
Here Insert Picture Description
select the installation path
Here Insert Picture Description
Here Insert Picture Description
Click Install to begin the installation.
After installation you can see:
Here Insert Picture Description
Click anaconda prompt enter the command line:
Here Insert Picture Description
Enter view conda -V version correctly display the installation was successful.

3 conda command

3.1 Local common operating environment

#获取版本号
conda --version 或 conda -V

#检查更新当前conda
conda update conda

#查看当前存在哪些虚拟环境
conda info -e

#查看--安装--更新--删除包

conda list:
conda search package_name# 查询包
conda install package_name
conda install package_name=1.5.0
conda update package_name
conda remove package_name

3.2 to create a virtual environment

  Use conda create -n your_env_name python = XX (2.7,3.6, etc.), anaconda command creates python version XX, named your_env_name virtual environment. your_env_name files can be found in the Anaconda installation directory envs file. Specifies the python version 2.7, you need to specify at least pay attention to python version or packages to be installed, when you do not specify python version, python automatically install the latest version.

#创建名为your_env_name的环境
conda create --name your_env_name
#创建制定python版本的环境
conda create --name your_env_name python=2.7
conda create --name your_env_name python=3.6
#创建包含某些包(如numpy,scipy)的环境
conda create --name your_env_name numpy scipy
#创建指定python版本下包含某些包的环境
conda create --name your_env_name python=3.6 numpy scipy

3.3 virtual environment

# 激活虚拟环境
activate your_env_name
# 退出虚拟环境
deactivate your_env_name
# 删除虚拟环境
conda remove -n your_env_name --all
conda remove --name your_env_name --all
# 复制虚拟环境
conda create --name new_env_name --clone old_env_name

3.4 in the specified environment management pack

conda list -n your_env_name
conda install --name myenv package_name 
conda remove --name myenv package_name

Use source software to accelerate domestic conda

$ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
$ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
$ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
$ conda config --set show_channel_urls yes

3.6 Use source software to accelerate domestic pip

1.临时设置方法:

可以在使用pip的时候加在最后面加上参数 -i https://pypi.tuna.tsinghua.edu.cn/simple

例如:pip install jieba -i https://pypi.tuna.tsinghua.edu.cn/simple  # jieba 是一个包

2.永久设置方法:

pip install pip -U
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

配置完之后就可以像平常一样安装包,速度提升几十倍

例如:pip install jieba
Published 21 original articles · won praise 1 · views 1120

Guess you like

Origin blog.csdn.net/Elenstone/article/details/105120661