MongoEngine导入问题 - Python

时间:2015-10-27 18:02:08

标签: python mongodb python-2.7

我正在使用var audioPlayer : AVAudioPlayer! @IBAction func playButtonClicked(sender : AnyObject){ let dispatchQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0) dispatch_async(dispatchQueue, { if let data = NSData(contentsOfFile: self.audioFilePath()) { do{ let session = AVAudioSession.sharedInstance() try session.setCategory(AVAudioSessionCategoryPlayback) try session.setActive(true) self.audioPlayer = try AVAudioPlayer(data: data) //self.audioPlayer.delegate = self self.audioPlayer.prepareToPlay() self.audioPlayer.play() } catch{ print("\(error)") } } }); } func audioFilePath() -> String{ let filePath = NSBundle.mainBundle().pathForResource("mySong", ofType: "mp3")! return filePath } pymongo。 当我做的时候

mongoengine

在我的import mongoengine 目录中 我收到以下错误:

/home/ubuntu/project

在其他目录中,我可以运行>>> import mongoengine Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Library/Python/2.7/site-packages/mongoengine/__init__.py", line 1, in <module> import document File "/Library/Python/2.7/site-packages/mongoengine/document.py", line 2, in <module> import pymongo File "/Library/Python/2.7/site-packages/pymongo/__init__.py", line 83, in <module> from pymongo.collection import ReturnDocument File "/Library/Python/2.7/site-packages/pymongo/collection.py", line 17, in <module> import collections File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/collections.py", line 10, in <module> from keyword import iskeyword as _iskeyword ImportError: cannot import name iskeyword 命令,但不能在我的项目目录中运行。例如,在import我得到:

/home/ubuntu/

任何线索?

******编辑******

似乎有些混淆:使用>>> import mongoengine >>> 安装pymongomongoengine

pip

1 个答案:

答案 0 :(得分:0)

看起来pymongo或mongoengine不包含在您的默认python路径中。

尝试使用以下命令安装

pip install pymongo
pip install mongoengine

Source有关安装文档和更多详细信息。 Source for mongoengine文档。