Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install PyMongo

Tags:

python

pymongo

I am currently trying to install MongoDB driver for Python on my Mac OS X (mavericks).

But when I run

[ Dsl  ~/Documents/python ] sudo easy_install pymongo

I get the following output

Searching for pymongo
Best match: pymongo 2.7
Processing pymongo-2.7-py2.7-macosx-10.9-intel.egg
Removing pymongo 2.7rc1 from easy-install.pth file
Adding pymongo 2.7 to easy-install.pth file

Using /Library/Python/2.7/site-packages/pymongo-2.7-py2.7-macosx-10.9-intel.egg
Processing dependencies for pymongo
Finished processing dependencies for pymongo

I try a lot of different commands, but nothing work. How to install pymongo ?

Thanks for your help

Edit: When I try to use it in a python script

#!/usr/bin/env python3
import pymongo

client = MongoClient()

I have this error

Traceback (most recent call last):
  File "./mongo.py", line 2, in <module>
    import pymongo
ImportError: No module named 'pymongo'
like image 327
Anthony Pradal Avatar asked Oct 06 '14 14:10

Anthony Pradal


4 Answers

Try these commands. Source

$ easy_install -U setuptools
$ python -m easy_install pymongo
like image 164
Jayram Avatar answered Oct 09 '22 05:10

Jayram


I have same error , and I can fix it following command.

sudo pip3 install pymongo

sudo apt-get install python3-pip

Try this. but this command for Ubuntu 14.04 OX.not sure is this work in Max OS X.

like image 22
uma Avatar answered Oct 09 '22 06:10

uma


python3 -m pip install pymongo

worked for me in OS X

like image 4
Jonathan Bencomo Avatar answered Oct 09 '22 04:10

Jonathan Bencomo


Installing pymongo goes very simple

Make sure that python is installed already in your machine.If not check here for quick installation.

CentOS:

Update using yum

yum -y update

Download the pip using curl:

curl "https://bootstrap.pypa.io/get-pip.py" -o "get-pip.py"

Install pip command using python

python get-pip.py

Install pymongo using pip

pip install pymongo
like image 2
Jerry Avatar answered Oct 09 '22 04:10

Jerry