Under Anaconda3.6, configure py2.7 and py3.5 environment respectively

to download and install Anoconda3.6

  • terminal directly bash Anaconda3-5.2.0-Linux-x86_64.sh to
  • Enter : yes or no

Verify installation effect

  • Input: conda -V
  • @:
conda 4.5.4
  • 输入: python
  • 出:
Python 3.6.5 |Anaconda, Inc.| (default, Apr 29 2018, 16:14:56) 
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 

到这里, prove anaconda installation All right. If there is a problem, Baidu can configure the following.

Based on python3.5 Create a environment called py3

conda create --name py3 python=3.5
  • terminal Output:
Solving environment: done


==> WARNING: A newer version of conda exists. <==
  current version: 4.5.4
  latest version: 4.5.11

Please update conda by running

    $ conda update -n base conda
## Package Plan ##

  environment location: /home/veyron/anaconda3/envs/py3

  added / updated specs: 
    - python=3.5


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    certifi-2018.8.24          |           py35_1         139 KB
    setuptools-40.2.0          |           py35_0         571 KB
    python-3.5.6               |       hc3d631a_0        28.3 MB
    wheel-0.31.1               |           py35_0          63 KB
    pip-10.0.1                 |           py35_0         1.8 MB
    ------------------------------------------------------------
                                           Total:        30.8 MB

The following NEW packages will be INSTALLED:

    ca-certificates: 2018.03.07-0           
    certifi:         2018.8.24-py35_1       
    libedit:         3.1.20170329-h6b74fdf_2
    libffi:          3.2.1-hd88cf55_4       
    libgcc-ng:       8.2.0-hdf63c60_1       
    libstdcxx-ng:    8.2.0-hdf63c60_1       
    ncurses:         6.1-hf484d3e_0         
    openssl:         1.0.2p-h14c3975_0      
    pip:             10.0.1-py35_0          
    python:          3.5.6-hc3d631a_0       
    readline:        7.0-h7b6447c_5         
    setuptools:      40.2.0-py35_0          
    sqlite:          3.24.0-h84994c4_0      
    tk:              8.6.8-hbc83047_0       
    wheel:           0.31.1-py35_0          
    xz:              5.2.4-h14c3975_4       
    zlib:            1.2.11-ha838bed_2      

Proceed ([y]/n)? 

Downloading and Extracting Packages
certifi-2018.8.24    |  139 KB | ####################################### | 100% 
setuptools-40.2.0    |  571 KB | ####################################### | 100% 
python-3.5.6         | 28.3 MB | ####################################### | 100% 
wheel-0.31.1         |   63 KB | ####################################### | 100% 
pip-10.0.1           |  1.8 MB | ####################################### | 100% 
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
#
# To activate this environment, use:
# > source activate py3
#
# To deactivate an active environment, use:
# > source deactivate
#

Based on python2.7 Create an environment called py2

conda create --name py2 python=2.7
  • output:
Solving environment: done


==> WARNING: A newer version of conda exists. <==
  current version: 4.5.4
  latest version: 4.5.11

Please update conda by running

    $ conda update -n base conda



## Package Plan ##

  environment location: /home/veyron/anaconda3/envs/py2

  added / updated specs: 
    - python=2.7


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    python-2.7.15              |       h1571d57_0        12.1 MB
    wheel-0.31.1               |           py27_0          62 KB
    pip-10.0.1                 |           py27_0         1.7 MB
    setuptools-40.2.0          |           py27_0         585 KB
    certifi-2018.8.24          |           py27_1         139 KB
    ------------------------------------------------------------
                                           Total:        14.6 MB

The following NEW packages will be INSTALLED:

    ca-certificates: 2018.03.07-0           
    certifi:         2018.8.24-py27_1       
    libedit:         3.1.20170329-h6b74fdf_2
    libffi:          3.2.1-hd88cf55_4       
    libgcc-ng:       8.2.0-hdf63c60_1       
    libstdcxx-ng:    8.2.0-hdf63c60_1       
    ncurses:         6.1-hf484d3e_0         
    openssl:         1.0.2p-h14c3975_0      
    pip:             10.0.1-py27_0          
    python:          2.7.15-h1571d57_0      
    readline:        7.0-h7b6447c_5         
    setuptools:      40.2.0-py27_0          
    sqlite:          3.24.0-h84994c4_0      
    tk:              8.6.8-hbc83047_0       
    wheel:           0.31.1-py27_0          
    zlib:            1.2.11-ha838bed_2      

Proceed ([y]/n)? y


Downloading and Extracting Packages
python-2.7.15        | 12.1 MB | ####################################### | 100% 
wheel-0.31.1         |   62 KB | ####################################### | 100% 
pip-10.0.1           |  1.7 MB | ####################################### | 100% 
setuptools-40.2.0    |  585 KB | ####################################### | 100% 
certifi-2018.8.24    |  139 KB | ####################################### | 100% 
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
#
# To activate this environment, use:
# > source activate py2
#
# To deactivate an active environment, use:
# > source deactivate
#

Get it done.

  • Switch Environment Test:
source activate py2
(py2) veyron@veyron-pc:~$ python
Python 2.7.15 |Anaconda, Inc.| (default, May  1 2018, 23:32:55) 
[GCC 7.2.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.t
>>> exit()
(py2) veyron@veyron-pc:~$ source deactivate
veyron@veyron-pc:~$ source activate py3
(py3) veyron@veyron-pc:~$ python
Python 3.5.6 |Anaconda, Inc.| (default, Aug 26 2018, 21:41:56) 
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
(py3) veyron@veyron-pc:~$ source deactivate
veyron@veyron-pc:~$ conda -V
conda 4.5.4
veyron@veyron-pc:~$ python
Python 3.6.5 |Anaconda, Inc.| (default, Apr 29 2018, 16:14:56) 
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 

Configuration Pycharm

File | Settings | Project: mclearning | Project Interpreter | Show   All... Then go to the Add Python Interpreter, first select the left Conda Environment, then check the Existing environment and select the py environment that was previously configured.   For example, you need to configure py2.7 on /home/veyron/anaconda3/envs/py2/bin/python    For example, you need to configure py2.7 on /home/veyron/anaconda3/envs/py3/bin/python

.

This article summarizes the right to be a memo /