未能导入pymongo ubuntu

bar*_*kyo 7 python mongodb pymongo

我目前正在使用mongodb 2.2和pymongo 2.3版运行Ubuntu 12.04.我试图使用Twitters API收集一些信息,我在尝试导入mymongo时收到错误.这是我有的:

import pycurl, json
import pymongo


STREAM_URL = "https://stream.twitter.com/1/statuses/filter.json"
WORDS = "track=#obama"
USER = "myuser"
PASS = "mypass"
Run Code Online (Sandbox Code Playgroud)

ImportError:没有名为pymongo的模块有什么想法吗?

Jab*_*bba 8

我有同样的问题.Pymongo与bson包冲突.这对我有用:

sudo pip uninstall pymongo
sudo pip uninstall bson
sudo apt-get remove python-bson
sudo apt-get remove python-gridfs    # not sure if it's necessary
sudo pip install pymongo -U
Run Code Online (Sandbox Code Playgroud)


ele*_*cay 5

我遇到了同样的问题,我手动安装了它,如下所示:

$ wget http://pypi.python.org/packages/source/p/pymongo/pymongo-2.3.tar.gz
$ tar xzf pymongo-2.3.tar.gz
$ cd pymongo-2.3
$ python setup.py install
Run Code Online (Sandbox Code Playgroud)

对我有用。祝你好运。