使用"konsole"运行python脚本的命令 [英] Using "konsole" command to run python script

查看:271
本文介绍了使用"konsole"运行python脚本的命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从命令行打开konsole实例并运行python脚本.我正在尝试:

I'm trying to, from a command line, open an instance of konsole and run a python script. I'm trying:

konsole -hold -e  'python -i hello.py'

我得到的行为是打开一个持久的konsole,并且将我放入python中,但是脚本无法运行.

The behaviour I'm getting is that a persistent konsole opens, and I am dropped into python, but the script does not run.

Python 2.7.2+ (default, Oct  4 2011, 20:03:08) 
[GCC 4.6.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 

我需要怎么做才能使python脚本在konsole窗口中运行?

What do I need to do to get the python script to run in the konsole window?

推荐答案

jsbueno的解决方案是正确的.但是,如此处所述,您也可以做一些事情像这样...

jsbueno's solution is the correct one. However, as described here, you can also do something like this ...

konsole --hold -e /bin/sh -c "python -i hello.py"

P.S.您需要指定--workdir(在-e arg之前),或者提供python脚本的完整路径(如果它并不总是位于konsole的初始工作目录中).但是,您可能已经知道了.

P.S. you'll need to specify --workdir (before the -e arg), or provide the full path to the python script, if it's not always in the initial working dir of konsole. But, you probably already knew that.

这篇关于使用"konsole"运行python脚本的命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆