Skip to content

Instantly share code, notes, and snippets.

@korayguclu
Created July 20, 2017 20:27
Show Gist options
  • Save korayguclu/52348c6ab7c87c402201b45e63856f78 to your computer and use it in GitHub Desktop.
Save korayguclu/52348c6ab7c87c402201b45e63856f78 to your computer and use it in GitHub Desktop.
pyenv insallation

pyenv installation

pyenv installation on macos

$ brew update
$ brew install pyenv

~$ pyenv global
system
~$ pyenv versions
* system (set by /home/staff/jmoreira/.pyenv/version)

Usually you will only have one version of python installed, the system-wide version. That’s what’s shown in the above command. pyenv now allows you to expand upon this version. Let’s start by installing another python version. For instance, let’s go now to the cutting edge of python:

~$ pyenv install 3.4.0
Installing readline-6.3...
Installed readline-6.3 to /home/staff/jmoreira/.pyenv/versions/3.4.0

(By the way, there is no need to memorize these. pyenv install –list will show all available Python versions to install).

~$ pyenv versions
* system (set by /home/staff/jmoreira/.pyenv/version)
  3.4.0

pyenv now lists two python versions. To use python 3.4 as the global one we do:

pyenv global 3.4.0

You can also use pyenv to define a project-specific, or local, version of Python:

~$ pyenv global system

~$ mkdir cuting_edge
~$ cd cuting_edge/
~/cutting_edge$ pyenv local 3.4.0
~/cutting_edge$ python -V
Python 3.4.0
~/cutting_edge$ cd ..
~$ python -V
Python 2.7.6

It’s as simple as that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment