0

I'm running version 2.7.12 of python on my mac. For a project I need that version exactly, and for some reason the version I got inside the venv is 2.7.10.

I have tried a lot, even reinstalling the virtual environment from scratch, but it will still use that version.

Is there something I can do to update the version inside the virtual env?

Harald Nordgren
  • 11,693
  • 6
  • 41
  • 65
Pablo
  • 9,424
  • 17
  • 55
  • 78

1 Answers1

2

You can use pyenv to install other version of Python. See instructions on https://github.com/pyenv/pyenv-installer:

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

Follow the instructions to place the correct variables in your ~/.bash_profile, like this

echo 'export PATH="/root/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
' >> ~/.bash_profile

Restart you terminal, and then

pyenv install 2.7.12
pyenv local 2.7.12

Now Python 2.7.12 is availabe as python.

Pablo
  • 9,424
  • 17
  • 55
  • 78
Harald Nordgren
  • 11,693
  • 6
  • 41
  • 65