Pyenv allows you to easily control your python environment. The TechTeam recommends that you set your biotite globally to Python 3, and set subdirectories to Python 2 when scripts require it.
Thorough documentation and instructions on pyenv are here:
Quick start instructions for biotite:
(Shortened from “Basic GitHub Checkout” on https://github.com/pyenv/pyenv)
- Checkout from GitHub in the directory you wish to install. We recommend home directory:
$ git clone https://github.com/pyenv/pyenv.git ~/.pyenv
- Add to bash profile:
$ echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile $ echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile
pyenv initto your shell to enable shims and autocompletion. Please make sure
eval "$(pyenv init -)"is placed toward the end of the shell configuration file since it manipulates
PATHduring the initialization.
$ echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >> ~/.bash_profile
Note: There are some systems where the
BASH_ENVvariable is configured to point to
.bashrc. On such systems you should almost certainly put the above mentioned line
eval "$(pyenv init -)"into
.bash_profile, and not into
.bashrc. Otherwise you may observe strange behaviour, such as
pyenvgetting into an infinite loop. Make sure to check this because of the new ubuntu installation (Jan 2018.)
- Restart your shell so the path changes take effect. You can now begin using pyenv.
$ exec "$SHELL"
Examples of use:
- Install Python versions into
$ pyenv install 3.6.4 $ pyenv install 2.7.8
- See what versions you have installed. Asterisk indicates the one set in your environment:
$ pyenv versions 2.7.13 * 3.6.1 (set by /Users/home/.pyenv/version)
- See what version of python is running in your current location:
$ pyenv version 3.6.1 (set by /Users/home/.pyenv/version)
- Set global python environment:
$ pyenv global 3.6.1
- Set local python environment (a subdirectory for example):
/subdirectory$ pyenv local 2.7.13
- Run multiple python environments in path
For programs like dRep whose dependencies have programs that use python 2 and 3, you need to have multiple versions available in your path.
$ pyenv global 3.6.1 2.7.13
$ pyenv -h