问题描述
限时送ChatGPT账号..我发现其他一些人在问这个问题,但他们问题的答案对我没有帮助.我正在尝试学习 python 并尝试使文件可执行.
I've found a few other people asking this question, but the answers for their problem are not helping me. I trying to learn python and trying to make a file executable.
练习脚本在我输入 python ./userPrompt.py
时运行.但是当我尝试将它作为可执行文件运行时(只是 ./userPrompt.py
).
The practice script runs when I type python ./userPrompt.py
.
But when I try to run it as an executable (just ./userPrompt.py
).
我已经成功改变它chmod +x
这是我在文件第一行的内容:
I've successful change it chmod +x
And here's what i have in the top line of the file:
#! /user/bin/env python
这是我得到的错误
bash: ./userPrompt.py: /user/bin/env: bad interpreter: No such file or directory
但问题是如果我去/user/bin
,我可以找到env
.所以它肯定存在.为什么Ubuntu找不到它??
But the thing is if I go to /user/bin
I can find env
. So it definitely exists. Why can't Ubuntu find it??
我感谢人们在这方面可以给我的任何帮助.
I appreciate any help people can give me on this.
推荐答案
路径是/usr
,不是/user
.
这篇关于在linux中运行python可执行文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
更多推荐
[db:关键词]
发布评论