Ubuntu – Ubuntu 14.04 pyenv command not found

14.04command line

Pardon if already duplicate but I tried combing through the forums but it seems I can't get anywhere.

I am trying to install pyenv in Ubuntu 14.04 by doing these steps.

INSTALL PYENV DEPENDENCIES

sudo apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm git

DOWNLOAD AND INSTALL PYENV

curl -L https://raw.githubusercontent.com/yyuu/pyenv-installer/master/bin/pyenv-installer | bash

YOU WILL SEE THIS MESSAGE

WARNING: seems you still have not added 'pyenv' to the load path.
Load pyenv automatically by adding
the following to ~/.bash_profile:

export PATH="$HOME/user/.pyenv/bin:$PATH"

eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"

CLOSE TERMINAL WINDOW AND OPEN ANOTHER ONE

No command 'pyenv' found, did you mean:
 Command 'p7env' from package 'libnss3-tools' (main)
pyenv: command not found
No command 'pyenv' found, did you mean:
 Command 'p7env' from package 'libnss3-tools' (main)
pyenv: command not found
user@ubuntu:~$ 

Please help how I can identify what seems to be the problem since I tried putting the script in .bashrc and .profile and still when I issue pyenv after opening another terminal the command is still not found.

WHERE I INSTALLED PYENV.

user@ubuntu:~$ ls -la | grep pyenv
ls: cannot access .gvfs: Permission denied
drwxrwxr-x 10 user user 4096 Jan 28 06:40 .pyenv
user@ubuntu:~$ cd .pyenv
user@ubuntu:~/.pyenv$ ls -la 
total 96
drwxrwxr-x 10 user user  4096 Jan 28 06:40 .
drwxr-xr-x 18 user user  4096 Jan 28 07:32 ..
drwxrwxr-x  2 user user  4096 Jan 28 06:40 bin
-rw-rw-r--  1 user user 12550 Jan 28 06:40 CHANGELOG.md
-rw-rw-r--  1 user user  7477 Jan 28 06:40 COMMANDS.md
drwxrwxr-x  2 user user  4096 Jan 28 06:40 completions
drwxrwxr-x  8 user user  4096 Jan 28 06:40 .git
-rw-rw-r--  1 user user    88 Jan 28 06:40 .gitignore
drwxrwxr-x  2 user user  4096 Jan 28 06:40 libexec
-rw-rw-r--  1 user user  1092 Jan 28 06:40 LICENSE
-rw-rw-r--  1 user user   285 Jan 28 06:40 Makefile
drwxrwxr-x  9 user user  4096 Jan 28 06:40 plugins
drwxrwxr-x  3 user user  4096 Jan 28 06:40 pyenv.d
-rw-rw-r--  1 user user 12420 Jan 28 06:40 README.md
drwxrwxr-x  2 user user  4096 Jan 28 06:40 src
drwxrwxr-x  3 user user  4096 Jan 28 06:40 test
-rw-rw-r--  1 user user   139 Jan 28 06:40 .travis.yml
user@ubuntu:~/.pyenv$ cd bin
user@ubuntu:~/.pyenv/bin$ ls -l
total 4
lrwxrwxrwx 1 user user  16 Jan 28 06:40 pyenv -> ../libexec/pyenv
-rwxrwxr-x 1 user user 731 Jan 28 06:40 python-local-exec
user@ubuntu:~/.pyenv/bin$ 

Best Answer

The instructions are a bit misleading because .bash_profile is only sourced when Bash is started with the --login option (e.g. from the console or ssh). However, .profile is always used, so it makes sense to place environment changes there.

Add the following to ~/.profile:

export PATH="$HOME/.pyenv/bin:$PATH"    
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"

Open a new terminal window and your PATH variable will be correct to run pyenv.