[英]How do I run a python script using a specific interpreter?
I'm having problems with pygame as documented here: PyGame bogging down linux?我在使用pygame时遇到问题,如此处所述:
After a bit of searching around and brainstorming I realized it may be because I'm using python2.7 instead of 2.6 which PyGame was designed for.经过一番搜索和头脑风暴,我意识到这可能是因为我使用的是 python2.7 而不是 PyGame 设计的 2.6。
How do I run my script using the 2.6 interpreter instead of 2.7 (which seems to be the default).如何使用 2.6 解释器而不是 2.7(这似乎是默认值)运行我的脚本。
Thanks谢谢
OS - Ubuntu操作系统 - Ubuntu
Python installs different binaries (and links to binaries): Python 安装不同的二进制文件(和二进制文件的链接):
python
links to the system's standard Python (2) version python
链接到系统的标准 Python (2) 版本python3
links to the system's standard Python 3 version python3
链接系统标准Python 3版本python2
links to the system's standard Python 2 version python2
链接系统标准Python 2版本python2.7
is the Python 2.7 interpreter python2.7
是Python 2.7解释器python2.6
is the Python 2.6 interpreter python2.6
是Python 2.6解释器So just use it like this:所以只需像这样使用它:
python2.6 file.py
Note that you need to have Python 2.6 installed of course.请注意,您当然需要安装 Python 2.6。
First install the alternative Python using apt-get
and second, run with full path to the interpreter.首先使用apt-get
安装替代 Python,然后使用解释器的完整路径运行。
Also, on ubuntu you should be able to use something like python2.6 script.py
.此外,在 ubuntu 上,您应该能够使用类似python2.6 script.py
的东西。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.