- 在脚本顶部添加一个shebang行:
#!/usr/bin/env python
- 将脚本标记为可执行:
chmod +x myscript.py
- 将包含它的目录添加到
PATH
变量中。(如果要粘贴,则必须在主目录中.bashrc
或.bash_profile
目录中执行此操作。)
export PATH=/path/to/script:$PATH

#!/usr/bin/env python
chmod +x myscript.py
PATH变量中。(如果要粘贴,则必须在主目录中
.bashrc或
.bash_profile目录中执行此操作。)
export PATH=/path/to/script:$PATH