【发布时间】:2015-08-13 23:47:17
【问题描述】:
我想将 python 直接作为可执行文件运行,例如./xxx.py
但是,当我这样运行它时,它会自动使用 python 2.7 而不是 python 3。
如何使用 python 3 运行可执行的 python 文件?
情况:
./magane.py shell
它会给我
Python 2.7.9 (default, Apr 2 2015, 15:33:21)
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>>
但我想要这个:
python3 manage.py shell
/home/cliu/.local/lib/python3.4/site-packages/django/db/backends/sqlite3/base.py:57: RuntimeWarning: SQLite received a naive datetime (2015-05-31 15:24:46.785297) while time zone support is active.
RuntimeWarning)
Python 3.4.3 (default, Mar 26 2015, 22:03:40)
Type "copyright", "credits" or "license" for more information.
IPython 2.3.0 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
In [1]:
python3 使用 ipython 的地方。
【问题讨论】:
标签: python linux python-2.7 ubuntu python-3.x