Search code examples
pythonmongodbpippymongoeasy-install

Pymongo Installation & Executing on MacOS


May i know why i couldn't run the pymongo on MacOS? I installed the pymongo with

sudo easy_install pymongo

but i not sure why will i getting this error

  conn = Connection(ip)
  File "/Library/Python/2.7/site-packages/pymongo-2.4.2-py2.7-macosx-10.8-intel.egg/pymongo/connection.py", line 180, in __init__
  File "/Library/Python/2.7/site-packages/pymongo-2.4.2-py2.7-macosx-10.8-intel.egg/pymongo/mongo_client.py", line 269, in __init__
pymongo.errors.ConnectionFailure: could not connect to 192.168.0.1:27017: [Errno 51] Network is unreachable

thus i google and found i haven't initiate the pymongo yet, then i tried to run

mongod
mongo
./mongod

then it returned me command not found. tried to execute this

sudo export PATH=$PATH:/usr/local/mongodb/bin

Anyone know what's happening to my installation and how could i fix it? Thanks.


Solution

  • You have to install the mongodb server for osx: http://docs.mongodb.org/manual/tutorial/install-mongodb-on-os-x/