bash脚本失败了python3.8:找不到命令

发布于 2025-01-22 13:29:50 字数 566 浏览 4 评论 0原文

我是新手的狂欢和脚本。

简而言之,我要运行特定的构建,其中一项任务失败了。这是我第一次运行此构建,所以我期待各种问题。

该脚本以:#!/usr/bin/env bash

的失败:python3.8:命令在第X行中找不到,这是:python33 。

➜  ~ which python3
/usr/bin/python3
➜  ~ which python
/usr/bin/python

➜  ~ python3 --version
Python 3.8.9

alias python3.8='python3'

​python3.8终端现在键入'python3.8'。

这个问题的根源是什么?我知道我可能已经搞砸了很多事情。我也对所有这些狂欢概况感到困惑。在加载默认bash时使用ZSH?它是从哪里命令的?

感谢任何帮助...

I'm new to bash and scripting in general.

In short, I'm to run a particular build and one of the tasks fails. This is the first time I'm running this build so I was expecting all sort of issues.

The script starts with: #!/usr/bin/env bash

And fails with : python3.8: command not found at line X, which is: python3.8 -m venv $ENV_PATH

I'm using zsh, brew installed.

Which python:

➜  ~ which python3
/usr/bin/python3
➜  ~ which python
/usr/bin/python

Exact version:

➜  ~ python3 --version
Python 3.8.9

I also edited the .zshrc file and added an alias:

alias python3.8='python3'

And it opens up the Python3.8 terminal when I type 'python3.8' now.

What could be the source of this issue? I know I might have messed up a lot of things. I'm also confused with all of these Bash profiles. Using zsh while it loads the default bash? where does it take it's commands from?

Appreciate any help...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

回梦 2025-01-29 13:29:50

您需要采购路径:在致电Python之前,应该放置:

PATH+=:/usr/bin

Shell脚本中的路径与系统路径不同,因此您需要在Shell脚本中源源。

You need to source your PATH: Before you call python, you should put:

PATH+=:/usr/bin

The path in the shell script is different from your system path, so you need to source your system path within the shell script.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文