Because there are projects that require Python2 and Python3, Python2 and PYTHON3 environments are installed together on WIN10, where Anaconda is a scientific computing integration environment with PYTHON3
1. Installing Python2
- Download Python2 installation package on official website: https://www.python.org/downloads/release/python-2715/, My computer is win10 64-bit, so select Windows x86-64 MSI Installer for download
- Click Install package, select Install, all the way next. Note, tick add Python 3.6 to PATH: ( Note that because I have installed python2, I use Python3 to do the demo )
- Because Python3 will be installed next, navigate to Python2 's installation root and rename the executable python.exe to Python2.exe ( default python stands for Python3, Python2 represents python2 ):
- After the installation succeeds, at the cmd command line interface, verify that the installation is successful:
# Enter Python2, the installation is successful with the following display information Python 2.7.15 (V2.7.15:ca079a3ea3, APR 2018, 16:30:26) [MSC v.1500"help"] Copyright""credits""license " for more information. " >>>
2. Installing Anaconda
- To download the installation package:
- Because the speed of foreign software source is too slow, so use the domestic Tsinghua mirror source for download https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/
- Package selection of the latest, my system environment for WIN10 64-bit, so choose Anaconda3-5.2.0-windows-x86_64.exe
- Install: Open the installation package, all the way next. Note that the Add environment variable and default python3.6 as the Anaconda language are checked :
- After successful installation, open the CMD Command Line window and display the following information:
- Where, enter Python, default to Anaconda Python 3.6.2
3. Install PIP for Python2 for package management
- Pip installation, refer to my previous blog post. Address: https://www.cnblogs.com/lxr1995/p/9135807.html
4. Python3 Package Management under Anaconda
- Python3 comes with Pip, you can use PIP for Management, Pip's basic operation, refer to my previous post https://www.cnblogs.com/lxr1995/p/9135807.html.
- Anaconda comes with package management tools Conda:
#1. View the currently installed packagesConda List##部分信息显示如下:PS c:\windows\system32>Conda List#packages in Environment at C:\Users\GoFree\Anaconda3:#_ipyw_jlab_nb_ext_conf 0.1.0Py36he6757f0_0 Defaults_license1.1 Py36_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/FREEABSL-py 0.2.2 <pip>Alabaster0.7.10 Py36_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/Freeanaconda Custom Py36_0 https:mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/Freeanaconda-client 1.6.3 py36_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/Freeanaconda-navigator 1.6.4 Py36_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/Freeanaconda-project 0.6.0 py36_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/Freeasn1crypto0.24.0 <pip>Asn1crypto0.22.0 Py36_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/Freeastor0.6.2 <pip>astroid1.5.3 Py36_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/freeastropy2.0.2 Py36h75fd4a5_4 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/Freeattrs18.1.0 <pip>#2. Installation package (NumPy)#-n Specifies the installation environment, installed in the virtual environment Python2#do not write-N, installed by default in the current active environmentConda Install-N python2 numpy#3. Update package (NumPy)Conda Update NumPy#4. Unload Package (NumPy)Conda Remove NumPy#5. View package information (NumPy)Conda Search NumPy#6. View all environmental informationConda Info-e#7. Deleting a virtual Environment Python2#--all Specifies to delete the installation package under this environmentConda remove-n Py34-- All##############################################8. Update Conda, keep Conda up to dateConda Update Conda#9. Update AnacondaConda Update Anaconda#10. Update Python#assuming the current environment is Python 3.6, Conda will upgrade Python to the latest version of the 3.6.x seriesConda Update python
At this point, on my win10 system, there are both Python3 and Python2. Where the default Python is the Python3 version, Python2 needs to specifically specify
Due to the existence of two Python versions, two separate python2 and Python3 virtual environments were created by using Virtualenvwrapper-win, and different compilation environments were selected according to project needs
Anaconda (Python3) and Python2 installation (WIN10) and Conda Basic package management operations