2

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...

Sonya gold
  • 87
  • 1
  • 6
  • 1
    Try which python3 from a bash shell instead of zsh. PATH is possibly lacking in .bashrc – Sibster Apr 20 '22 at 12:34
  • I changed to the default bash...copied all the content of .zshrc into .bashrc (it did not exists before even) but it still fails with the same error after restarting the terminnal – Sonya gold Apr 20 '22 at 13:39
  • Isn't problem in dot `.` ? Did you try just `python3` (without `.8`)? – lojza Apr 20 '22 at 15:12
  • What you put into your .zshrc is of no relevance to bash scripts. Even a zsh script would usually not process this file. Similarily, a bash script would normally not process `.bashrc`. See the respective man pages for bash and zsh to learn which files are processed automatically. Also, remove the `zsh` tag if you don't script in zsh. – user1934428 Apr 21 '22 at 07:54
  • Did you manage to resolve this issue? – Bohdan Savych Jun 09 '23 at 13:58

1 Answers1

0

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.

GravoLan
  • 1
  • 3