pip and virtualenv
Upcoming SlideShare
Loading in...5
×
 

pip and virtualenv

on

  • 1,004 views

pip and virtualenv

pip and virtualenv

a lightning talk for the "Python for beginners" meetup
Barcelona 20/03/2014

Statistics

Views

Total Views
1,004
Views on SlideShare
406
Embed Views
598

Actions

Likes
0
Downloads
0
Comments
0

5 Embeds 598

http://pybcn.org 569
http://127.0.0.1 22
http://feedly.com 4
https://twitter.com 2
http://www.slideee.com 1

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

pip and virtualenv pip and virtualenv Presentation Transcript

  • and now, for something completely different…
  • pip & virtualenv Alex Maneu ! @zouave @PyBcn 20/03/2014
  • what is this about? package management when you need something someone else has written
  • some examples SciPy lxml requests django pymongo
  • jars gems eggs (wheels)
  • where to find them? PyPI pypi.python.org Python Package Index
  • pip Recommended tool for installing uninstalling upgrading packages from PyPI
  • pip basic commands pip install [—-upgrade] <package> Installs a Python package or upgrades it to the latest available version. ! Examples pip install pymongo=1.2 pip install /some/dir/mypackage.tgz pip install http://someserver/mypackage.zip pip install git+ssh://myserver/myrepo.git@feature#egg=MyPackage ! ! pip uninstall <package> Deletes an already installed package
  • pip basic commands pip list [—-outdated] Lists installed packages ! ! pip search <string> Searches for packages whose description contains the specified string > pip list --outdated amqp (Current: 1.3.3 Latest: 1.4.4) billiard (Current: 3.3.0.8 Latest: 3.3.0.16) celery (Current: 3.1.5 Latest: 3.1.9) … Examples > pip search cassandra cqlengine - Cassandra CQL 3 Object Mapper for Python CassandraLauncher - Command line utilities for launching Cassandra clusters in EC2 pycassa - Python client library for Apache Cassandra …
  • what happens if…? > pip install pymongo ! (…) error: could not create '/Library/Python/ 2.7/site-packages/bson': Permission denied
  • virtualenv Tool for creating Python environments i s o l a t e d
  • virtualenv v1 v2 v3 django lxml + site packages numpy=1.8.0 pymongo requests>=2.2.0 site packages pyOpenSSL, pip, numpy=1.6.2
  • creating a virtual env virtualenv [options] <dest_dir> Create a new virtual environment at the specified path. It will contain a copy of all system-wide packages. ! Useful options —-no-site-packages Create a new empty virtual environment. —-python=<python path> Use the specified Python executable.
  • switching to a virtual env > source <dir>/bin/activate (v1)> ! ! Exiting current virtualenv (v1)> deactivate >
  • cool stuff with pip + virtualenv ! pip freeze > requirements.txt Create a description file with the packages and versions installed under the current virtualenv. ! pip install -r requirements.txt Install all packages according to the specification in requirements.txt.
  • summary • Packages: code someone else has written (SciPy, Django, lxml, pymongo) • Find packages on PyPI: pypi.python.org • Install them using pip • Keep your environment clean by using virtualenv
  • Thank you! questions?