Pip & Pyenv:
Tools of the Craft

Pyenv & Pip: Tools of the Craft

@kevin_noonan

PyCon Ireland 2013

Oct 12th, Dublin

Main Portal of the Fortress of Kuelap

Walls of the Fortress of Kuelap, Chachapoyas, Amazonas, Peru

Pip

Pip is a package manager

Pip is a tool to install Python libraries and tools

www.pip-installer.org

A Dependency Tree

Get pip on a Mac

brew install python

Yes, python from Homebrew has pip already in the box

Get pip on Windows

Use Choclatey: www.choclatey.org

cinst pip

Get Pip on Linux

sudo apt-get install python-pip

You need a library?

pypi.python.org

What if you need an AI for global thermonuclear Armageddon?

pip install skynet

Pyenv

Pyenv is a tool for installing and managing several versions of Python on the same box.

https://github.com/yyuu/pyenv

To install Pyenv on a Mac...

brew update

brew install pyenv

(For other systems, see the docs on Github.)

List installed versions of Python

$ pyenv versions
* system (set by /Users/kevin/.pyenv/version)
3.3.2

Make Python 3.3.2 the global default Python

$ pyenv global 3.3.2

$ pyenv versions
system (set by /Users/kevin/.pyenv/version)
* 3.3.2

Install a new version of Python

$ pyenv install jython-2.5.3

$ pyenv install pypy-1.9

pyenv-virtualenv

pyenv-virtualenv is a virtualenv plugin for pyenv

Installation

If you're on a Mac...

brew install pyenv-virtualenv

(See the docs on Github for other systems.)

Create a new virtual environment for a project,
to use Python 3.3.2.

$ pyenv virtualenv 3.3.2 my-new-proj-pyenv332venv

Credits

Kuelap exterior walls
http://www.flickr.com/people/edenandjosh/
http://farm4.staticflickr.com/3211/2892129997_052ef11f87_b.jpg

Kuelap entrance portal
http://www.flickr.com/photos/morrissey/
http://farm1.staticflickr.com/161/406292920_38b9de28d5_o.jpg

Giant Tochigi tree
http://www.flickr.com/photos/mullenkedheim/
http://farm7.staticflickr.com/6122/6044098093_a86b8bfeca_b.jpg

Conclusions

pip to install a new library or tool.

pyenv to manage more than one Python.

pyenv-virtualenv for virtual environments.

Visit Kuelap in Peru, before you die!

/

#