Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bash: pyenv: command not found and how to solve it #103

Closed
goncaloperes opened this issue Nov 16, 2020 · 9 comments
Closed

bash: pyenv: command not found and how to solve it #103

goncaloperes opened this issue Nov 16, 2020 · 9 comments

Comments

@goncaloperes
Copy link

In CentOS 7, I ran

$ curl https://pyenv.run | bash

and then

$ exec $SHELL

However when trying to see if I had pyenv installed by updating it

pyenv update

I was getting the error

bash: pyenv: command not found


Solution (found here)

It turns out the pyenv path wasn't exported to .bashrc. It can be done by executing the following commands in terminal:

echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >> ~/.bashrc

Then restart the shell

exec "$SHELL"

@NikosAlexandris
Copy link

NikosAlexandris commented Dec 19, 2020

Same error under Funtoo-Linux. Using the above fix, the error message goes away, when starting a new interactive shell (terminal). However, when running

❯ pyenv
bash: pyenv: command not found

still errors out.

@ba2tro
Copy link

ba2tro commented Mar 17, 2021

For Ubuntu OS, you can face the same problem. So, after installing the dependencies and pyenv in terminal just type the following commands one by one :
$ export PATH="/home/username/.pyenv/bin:$PATH"
$ eval "$(pyenv init -)"
$ eval "$(pyenv virtualenv-init -)"
Afterwards you can check if it worked by just hitting enter after typing pyenv
This should return the help documentation of pyenv, i.e., the basic commands and other help content
Your welcome!

@bdv1234
Copy link

bdv1234 commented May 24, 2021

I have done the steps provided by @goncaloperes . but still I am getting below error.

I am using Centos 7. Can anyone face this issue ?

[centos@localhost ~]$ exec "$SHELL"
WARNING: pyenv init - no longer sets PATH.
Run pyenv init to see the necessary changes to make to your configuration.

@native-api
Copy link
Member

native-api commented May 25, 2021

Pyenv installer gives you instructions about what you need to do next (install Pyenv into the shell, it can't do that automatically due to many different shell setups out there).

Note that in version 2.0.0, the required shell setup has changed, so please heed the instructions (so that you don't waste your and our time reporting bugs that are not there).

@iamrathore
Copy link

For Ubuntu OS, you can face the same problem. So, after installing the dependencies and pyenv in terminal just type the following commands one by one : $ export PATH="/home/username/.pyenv/bin:$PATH" $ eval "$(pyenv init -)" $ eval "$(pyenv virtualenv-init -)" Afterwards you can check if it worked by just hitting enter after typing pyenv This should return the help documentation of pyenv, i.e., the basic commands and other help content Your welcome!

The problem is not solved, still getting the same error.

@tjyang
Copy link

tjyang commented Dec 26, 2021

on RL8, a note to myself or other.

After I exited out of 2nd bash spawn of 1st bash. the installer script works.

[me@rocky8t01 ~]$ ps
    PID TTY          TIME CMD
 816324 pts/0    00:00:01 bash
1061241 pts/0    00:00:00 bash
1062501 pts/0    00:00:00 ps
[me@rocky8t01 ~]$ exit
[me@rocky8t01 salt]$ ps
    PID TTY          TIME CMD
 816324 pts/0    00:00:01 bash
1062591 pts/0    00:00:00 ps
[me@rocky8t01 salt]$ curl https://pyenv.run | bash
<snipped>
[me@rocky8t01 salt]$ exec "$SHELL"

@nuggetofwisdom
Copy link

For Ubuntu OS, you can face the same problem. So, after installing the dependencies and pyenv in terminal just type the following commands one by one : $ export PATH="/home/username/.pyenv/bin:$PATH" $ eval "$(pyenv init -)" $ eval "$(pyenv virtualenv-init -)" Afterwards you can check if it worked by just hitting enter after typing pyenv This should return the help documentation of pyenv, i.e., the basic commands and other help content Your welcome!

I hope both sides of your pillow are cold tonight :)

@Al-Sharabi
Copy link

Al-Sharabi commented Feb 18, 2023

If you have downloaded pyenv to your home directory, all you have to do is add
export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
to either .bashrc if you are using bash or .zshrc if you are using Oh My Zsh.

@urosch
Copy link

urosch commented Oct 20, 2023

If you are on a mac for example and use zsh use this:

echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.zshrc
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.zshrc
echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >> ~/.zshrc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants