ubuntu16.04下利用anaconda实现python2和python3的切换

  1. 在ubuntu16.04安装anaconda后,用命令 anaconda-navigator 打开ANACONDA NAVIGATOR 页面,点击environments 之后,创建两个环境,一个环境安装python2, 另一个环境安装python3. 我的电脑中,环境py27_tf1120_cpu 安装了python2, 环境py367_tf1120_cpu 安装了python3.
  2. 打开命令行窗口, `source activate py27_tf1120_cpu`进入python2环境;
(base) jerry@jerry-Inspiron-7460:~$ source activate py27_tf1120_cpu
(py27_tf1120_cpu) jerry@jerry-Inspiron-7460:~$ python --version
Python 2.7.15 :: Anaconda, Inc.
  1. source activate py367_tf1120_cpu进入python3环境
(py27_tf1120_cpu) jerry@jerry-Inspiron-7460:~$ source deactivate
(base) jerry@jerry-Inspiron-7460:~$ source activate py367_tf1120_cpu
(py367_tf1120_cpu) jerry@jerry-Inspiron-7460:~$ python --version
Python 3.6.7 :: Anaconda, Inc.

猜你喜欢

转载自blog.csdn.net/johnboat/article/details/86501691