1

I did a fresh install of Ubuntu 16 LTS, but keeping a dump of the packages I had installed previously, and reinstalling them, using the answers to this question: How to backup settings and list of installed packages.

After running updates again, I tried to use python, and got this error:

/home/niel/.pyenv/libexec/pyenv-exec: line 47: /home/niel/.pyenv/versions/3.4.0/bin/python: No such file or directory

I checked manually and /home/niel/.pyenv/versions/3.4.0/bin/python does exist.

But running /home/niel/.pyenv/versions/3.4.0/bin/python3.4 --version gives me the same error.

bash: /home/niel/.pyenv/versions/3.4.0/bin/python3.4: No such file or directory

What's wrong here? Could the paths be broken?

UPDATE: Changing the paths in .bash_profile from

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

to

export PATH=${PATH}:/usr/bin/python3

seems to fix the problem, using the working python in /usr/bin. Is this a good fix?

Niel
  • 113
  • 1
    I wouldn't qualify this as a "fresh install". Hard/impossible to decide what exactly happened in your case. – Jacob Vlijm Jan 11 '17 at 09:25
  • What should I call it? And if you need any more information just tell me and I'll add it. – Niel Jan 11 '17 at 09:27

1 Answers1

1

It looks like pyenv, which does not ship with Ubuntu, has taken over your PATH and is assuming that the system has Python 3.4 available. However, you have upgraded to 16.04 which ships Python 3.5, not Python 3.4.

To fix the problem, you should either remove pyenv or configure it to understand your upgraded system correctly.

Since the installation instructions tell you to modify .bashrc, doing so in reverse seems reasonable. To cleanly remove it, you should also reverse your changes to .bash_profile since the installation instructions tell you to do this also.

As this is a pyenv-specific problem, and Ubuntu does not ship pyenv, you should probably raise this problem with them.

Robie Basak
  • 15,670