我有一个Python脚本“program.py”,需要2个命令行参数。在命令行上运行python文件?
当我想上运行命令行这一计划,我应该输入:
./python myprogram.py arg1 arg2
不过,我想没有“蟒蛇”运行我的脚本和“py”为
换句话说,我想这样做:
./myprogram arg1 arg2
我写了一个shell脚本 “myprogram.sh”:
#!/bin/bash
python myprogram.py
但我还是必须通过键入
./sh myprogram.sh arg1 arg2
这仍然不是我想要的运行此
有没有办法做到这一点?
感谢
你让它可执行吗? http://effbot.org/pyfaq/how-do-i-make-a-python-script-executable-on-unix.htm – dm03514