在linux中运行python可执行文件 [英] running python executable in linux

查看:48
本文介绍了在linux中运行python可执行文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现其他一些人在问这个问题,但他们问题的答案对我没有帮助.我正在尝试学习 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆