尝试与pymongo建立连接并收到此错误:
>>> from pymongo import Connection
>>> con = Connection('localhost')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/pymongo/connection.py", line 236, in __init__
max_pool_size, document_class, tz_aware, _connect, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/pymongo/mongo_client.py", line 369, in __init__
raise ConnectionFailure(str(e))
pymongo.errors.ConnectionFailure: [Errno 111] Connection refused
答案 0 :(得分:0)
Connection refused
表示您没有运行MongoDB实例。
首先,你应该开始吧。 例如,对于Ubuntu,它将是:
sudo service mongod start
但在此之前,请确保安装了mongodb。