`pyenv global 3.8.0` does not change the python version on mac os

Hi,

I’m learning to test macOS environment setting with python 3.8.0, but I constantly failed with wrong python version.

https://travis-ci.org/github/cielong/pyfx/jobs/735081001#L85.

So what I’m trying is to do it to invoke python as python3 to help to aggregate the install section.

But from the log

with pyenv versions, the version has been correctly set to 3.8.0,
with python --version on the next line, it still routes to 2.7.17.

What did I miss and what should be the workround?

Execute the following so that the python command is redirected properly.

eval "$(pyenv init -)"

1 Like

Thanks so much. I thought the environment will run this for me on start up!

Add eval "$(pyenv init -)" (note the quotes) to your script to add Pyenv shims directory to PATH.


You likely want to add /Users/travis/.pyenv/versions to cache and do pyenv install -s to avoid building Python from source anew every time.

Thanks so much! Yes it works.

Ah, sh1t! In OSX, /home is a weird mountpoint; it needs to rather be /Users/travis/.pyenv/versions.

Oh man, thanks. That really solve my weird cache questions!