Ubuntu 14.04 pyenv command not found

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

3 Answers

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.

11

In the main folder (the one shown when you open the file explorer, or you can view the path with the pwd command in the console) use Ctrl H, and then find the file .bash_profile and add it at the end:

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

Instead of using pyenv you can follow the steps in below.

  1. After successfully installed pip in your Ubuntu machine run the following command:

    pip3 install virtualenv
  2. Once it is installed, check to verify that the installation has completed successfully:

    virtualenv --version

    If you get the output something similar 16.4.3 than you have successfully installed virtualenv.

  3. Now run the following command to create a directory called new-dir, or another name of your choice. Then navigate to the directory.

    mkdir new-dir
    cd new-dir
  4. Now create your virtual environment, named newENV or anything else:

    virtualenv newENV
  5. And activate the virtual environment

    . env/bin/activate
1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like