Skip to content

Instantly share code, notes, and snippets.

@deadcoder0904
Created October 14, 2016 18:41
Show Gist options
  • Save deadcoder0904/fd5a4c53bd67b09ba6f1005be56d9d10 to your computer and use it in GitHub Desktop.
Save deadcoder0904/fd5a4c53bd67b09ba6f1005be56d9d10 to your computer and use it in GitHub Desktop.
Install 3rd Party modules in Python( Ubuntu )
There are three ways to install Python libraries:
(1) Use apt-get, aptitude or similar utilities.
(2) Use easy_install or pip (install pip first, its not available by default)
(3) If you download some .tar.gz file, unzip it and then type sudo python setup.py install
Manually messing with paths and moving files around is the first step to headaches later. Do not do it.
For completeness I should mention the portable, isolated way; that is to create your own virtual environment for Python.
(1) Run sudo apt-get install python-virtualenv
(2) virtualenv myenv (this creates a new virtual environment. You can freely install packages in here without polluting your system-wide Python libraries. It will add (myenv) to your prompt.)
(3) source myenv/bin/activate (this activates your environment; making sure your shell is pointing to the right place for Python)
(4) pip install _____ (replace __ with whatever you want to install)
(5) Once you are done type deactivate to reset your shell and environment to the default system Python.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment