Database Reference
In-Depth Information
Installing PyMongo under Linux
Python offers a specific package for MongoDB support called PyMongo. This package
allows you to interact with the MongoDB database, but you will need to get this driver
up and running before you can use this powerful combination. As when installing
the PHP driver, there are two methods you can use to install PyMongo: an automated
approach that relies on setuptools or a manual approach where you download the
source code for the project. The following sections show you how to install PyMongo
using both approaches.
Installing PyMongo Automatically
The pip application that comes bundled with the python-pip package lets you automatically
download, build, install, and manage Python packages. This is incredibly convenient,
enabling you to extend your Python modules installation even as it does all the work for you.
You must have setuptools installed before you can use the pip application.
This will be done automatically when installing the python-pip package.
Note
To install pip , all you need to do is tell apt-get to download and install it, like so:
$ sudo apt-get install python-pip
When this line executes, pip will detect the currently running version of Python
and installs itself on the system. That's all there is to it. Now you are ready to use the pip
command to download, make, and install the MongoDB module, as in this example:
$ sudo pip install pymongo
Again, that's all there is to it! PyMongo is now installed and ready to use.
You can also install previous versions of the pyMongo module with pip using the
pip install pymongo= x.y.z command. here, x.y.z denotes the version of the module.
Tip
Installing PyMongo Manually
You can also choose to install PyMongo manually. Begin by going to the download section
of the site that hosts the PyMongo plugin ( http://pypi.python.org/pypi/pymongo ). Next,
download the tarball and extract it. A typical download and extract procedure might look
like this in your console:
$ wget http://pypi.python.org/packages/source/p/pymongo/pymongo-2.5.1.tar.gz
$ tar xzf pymongo-2.5.1.tar.gz
 
 
Search WWH ::




Custom Search