User Tools

Site Tools


wiki:python:pythonenvironments

Different version and evironments

Python has some peculiar ways to manage use of different versions of the language, packages and to allow the deployment of running environments for your code. You will soon need to understand how to distribute your scripts and program to others as well on all your computers and clusters. The main other problem is how to force to cohexist scripts that require different/colliding versions of packages, and simply how to work when your system administrator is not around.

All different approaches have pros and cons.

  • Use your distribution kits (e.g. rpm and deb packages)
  • Use python.org kits
  • Use pyenv to switch versions of language (mainly 2 vs 3, but non only)
  • Use virtualenv to switch versions of packages
  • Use third party Anaconda and its conda/miniconda tool
  • Use homebrew on MacOS.
  • Use a general deployment tool, such as docker and other containers

Pyenv pre-reqs

sudo apt install curl git-core gcc make zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev libssl-dev

In general, right dependencies for Python are documented (and up-to-date) here:

https://devguide.python.org/setup/#build-dependencies

Pyenv install

The recommended way is using the pyenv installer

https://github.com/pyenv/pyenv-installer

else it is possible to clone the official repository from github:

git clone https://github.com/pyenv/pyenv.git $HOME/.pyenv
wiki/python/pythonenvironments.txt · Last modified: 2020/07/17 06:39 (external edit)