简体   繁体   English

在linux中运行python可执行文件

[英]running python executable in linux

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并试图使文件可执行。

The practice script runs when I type python ./userPrompt.py . 当我输入python ./userPrompt.py时,练习脚本会运行。 But when I try to run it as an executable (just ./userPrompt.py ). 但是当我尝试将其作为可执行文件运行时(只是./userPrompt.py )。

I've successful change it chmod +x And here's what i have in the top line of the file: 我已成功更改它chmod +x这里是我在文件顶行的内容:

    #! /user/bin/env python 

and here's the error I get 这是我得到的错误

   bash: ./userPrompt.py: /user/bin/env: bad interpreter: No such file or directory

But the thing is if I go to /user/bin I can find env . 但问题是如果我去/user/bin我可以找到env So it definitely exists. 所以它肯定存在。 Why can't Ubuntu find it?? 为什么Ubuntu找不到它?

I appreciate any help people can give me on this. 我感谢人们可以给我的任何帮助。

路径是/usr ,而不是/user

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM