Pycharm在gnome终端上运行Python脚本 [英] Pycharm run Python script on gnome terminal
本文介绍了Pycharm在gnome终端上运行Python脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有办法在gnome终端而不是PyCharm控制台上运行我的python脚本?我怎么能这样做?
我的尝试:
我在网上搜索但我找不到任何有用的信息
Is there a way to run my python script on gnome terminal instead of PyCharm console ? How can i do that ?
What I have tried:
I searched on net but i cant find any useful information
推荐答案
只需将脚本名称传递给 python 解释器:
Just pass the script name to the python interpreter:
python myscript.py
你也可以通过在顶部添加第一行来告诉shell如何处理脚本脚本文件:
You can also tell the shell what to do with the script by adding this as first line on top of the script file:
#!/usr/bin/env python
然后使脚本可执行:
Then make the script executable:
chmod +x myscript.py
现在你可以在终端输入脚本名称了其他命令:
Now you can type the script name in the terminal like any other command:
./myscript.py
这篇关于Pycharm在gnome终端上运行Python脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文