Python pyenv - ghdrako/doc_snipets GitHub Wiki

Install

$ PROJECT=https://github.com/pyenv/pyenv-installer \  PATH=raw/master/bin/pyenv-installer \  curl -L $PROJECT/PATH | bashOf
git clone https://github.com/pyenv/pyenv-installer$ cd pyenv-installer$ bash pyenv-installe

pyenv does not work on Windows

setup

export PATH="~/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init

usage

from available interpreters. Enter the following to install a version. $ pyenv install <version>

For CPython, is the version number, such as 3.6.6 or 3.7.0rc1. An installed version is distinct from an available version. Versions are available globally (for a user) by using

$ pyenv global 3.7.0or locally by using
$ pyenv local 3.7.0Local

means they are available in a given directory. This is done by putting a python-version.txt file in this directory. This is important for version-controlled repositories, but a few different strategies are used to manage those. One strategy is to add this file to the ignored list. This is useful for heterogeneous teams or open source projects. Another strategy is to check in the file so that the same version of Python is used in the repository. Note that since pyenv is designed to install side-by-side versions of Python, it has no concept of upgrading Python. A newer Python version needs to be installed with pyenv and then set as the default. By default, pyenv installs non-optimized versions of Python. If optimized versions are needed, enter the following.

env PYTHON_CONFIGURE_OPTS="--enable-shared                           
--enable-optimizations                           
--with-computed-gotos                           
--with-lto                           
--enable-ipv6" pyenv install
⚠️ **GitHub.com Fallback** ⚠️