我正在MacOS上学习环境
#map_it.py - launches a map in the browser using an address from the command line or clipborad
#!/usr/bin/env python
import webbrowser, sys
if len(sys.argv) > 1:
#Get the address from the command line
address = "".join(sys.argv[1:])
print(address)
#todo:get the address from the clipboard
我将shebang设置为脚本的顶部,该脚本未能按预期工作
$ map_it.py test
-bash: map_it.py: command not found
$ map_it test
-bash: map_it: command not found
将#!/usr/bin/env python
更改为#!/usr/bin/env python3
和#!/usr/bin/env
之后,
报告相同的错误。
如何修复此类错误?
答案 0 :(得分:2)
您需要执行以下任一操作:
$ ./map_it.py test
或
$ python map_it.py test
...否则,您表示该脚本是系统安装的命令。