我想在 Mac 终端中使用命令行参数运行 exe 文件
p1.exe -f input.txt
但是我收到错误 -bash: p1: command not found
我已将 python 文件 p1.py 转换为 p1.exe,使用
pyintsaller p1.py --onefile
然后运行带参数的 python 文件就可以了
python p1.py -f input.txt
请您参考如下方法:
这与 Python 无关,而是一个基本的命令 shell 问题。要从当前目录运行可执行文件,您需要使用 ./ 前缀。
./p1.exe -f input.txt
请注意,为 Linux 可执行文件使用 .exe 扩展名有点奇怪。
