从 Python 3.3 到 Python 2.6
From Python 3.3 to Python 2.6
我的机器上安装了 Python 3.3,但由于我想使用只需要 Python 2.6 的程序,我该如何从 Python 3.3 移动至 Python 2.6
我正在使用 ubuntu。
使用python
代替python3
# Python2
$ python
Python 2.7.10 (default, Jul 30 2016, 18:31:42)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.34)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
# Python3
$ python3
Python 3.5.2 (default, Nov 7 2016, 17:25:58)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
或在您的 Python 文件中声明,
#!/usr/bin/env python
# -*- coding: utf-8 -*-
您可以为使用两个版本的 python 创建不同的环境,
此处提供了有关如何操作的快速指南:
https://uoa-eresearch.github.io/eresearch-cookbook/recipe/2014/11/20/conda/
我的机器上安装了 Python 3.3,但由于我想使用只需要 Python 2.6 的程序,我该如何从 Python 3.3 移动至 Python 2.6
我正在使用 ubuntu。
使用python
代替python3
# Python2
$ python
Python 2.7.10 (default, Jul 30 2016, 18:31:42)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.34)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
# Python3
$ python3
Python 3.5.2 (default, Nov 7 2016, 17:25:58)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
或在您的 Python 文件中声明,
#!/usr/bin/env python
# -*- coding: utf-8 -*-
您可以为使用两个版本的 python 创建不同的环境, 此处提供了有关如何操作的快速指南: https://uoa-eresearch.github.io/eresearch-cookbook/recipe/2014/11/20/conda/