在linux中运行python可执行文件

编程入门 行业动态 更新时间:2024-10-26 07:35:39
本文介绍了在linux中运行python可执行文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送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:关键词]

本文发布于:2023-04-29 07:48:23,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1186705.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:可执行文件   linux   python

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!