Switch between two versions of python in the same environment

I need to build a pipeline which was written in python 2.7. A few dependencies like matplotlib have been upgraded since then to work with Python 3.x, but the original pipeline code is incompatible with python 3.x syntax. While building, I am unable to use Python 2.7 as matplotlib and thereby mayavi refuse to be installed after that. And if I build everything using Python 3.x the final code does not execute because the code is incompatible with python 3.x.

The pipeline I need to run is

Please help.

3

1 Answer

You can use pyenv to switch between python versions.

# Get Pyenv
curl -L | bash
# add pyenv to ~/.bashrc
echo -e "export PATH="/root/.pyenv/bin:$PATH" \n eval "$(pyenv init -)" \n eval "$(pyenv virtualenv-init -)" " >> ~/.bashrc
source ~/.bashrc
# install python 3 via pyenv
pyenv install 3.5.6
# verify
pyenv versions
# pyenv local <version> : use this to set python version per directory.
# pyenv gloal <version> : use this to set python version globally.

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