I have pyenv installed in my environment and up to this weekend (when I installed 'Kivy') my pyenv/local setup has been working fine. But now when I go to my various python project directories, pyenv does not automatically activate the right python version properly.
E.g.
I create an environment using pyenv like this,
pyenv virtualenv 3.3.2 work
I make and go into a dir called work
and have a .python-version
file with the text work
as the sole content.
Pyenv detects that my environment is work
using this file but my python version is not python 3.3.2
instead it's 2.7.9
.
For some reason, something happened, and all of my pyenv virtual environments use 2.7.9
as opposed to the python version they were created with.
When I run which python
I get,
/opt/boxen/homebrew/bin/python
when I go to the pyenv version directory and run
$ cat pyvenv.cfg
home = /opt/boxen/pyenv/versions/3.3.2/bin
include-system-site-packages = false
version = 3.3.2
However, if I run pyenv activate
I my python version switches to python 3.3.2
(or the appropriate version for a given env).
Question is, how do I get pyenv to auto activate the environment's python version as it did before (before I did something to break it).
It sounds like, because of which python
not saying it's the shim, you don't have the bin/shims path first in your PATH
envvar. Add these lines to your shell startup script, and make sure they're at the end, after any other path manipulations.
export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
The eval
line does some additional shell monkeying I think to add the .pyenv/shims
directory...check that with an echo $PATH
maybe.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With