问题描述
我正在尝试根据 这个 教程.命令 import numpy as np
和 import caffe
运行良好.但是,当我尝试运行 import lmdb
和 import deepdish as dd
时,出现以下错误:
I'm trying to create an LMDB data base file in Python to be used with Caffe according to this tutorial. The commands import numpy as np
and import caffe
run perfectly fine. However, when I try to run import lmdb
and import deepdish as dd
, I'm getting the following errors:
>>> import lmdb
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named lmdb
>>> import deepdish as dd
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named deepdish
我在 Ubuntu 14.04 上通过 Anaconda 2.2.0(64 位)运行 Python 2.7.9.根据 this 页面安装 Caffe 的依赖项时,我已经通过 sudo apt-get install liblmdb-dev.
I'm running Python 2.7.9 through Anaconda 2.2.0 (64-bit) on Ubuntu 14.04. While installing the dependencies for Caffe according to this page, I've already installed the lmdb package through sudo apt-get install liblmdb-dev
.
知道为什么会发生此错误吗?
Any ideas why this error might be occuring?
推荐答案
好吧,apt-get install liblmdb-dev
可能适用于 bash(在终端中),但显然它不起作用使用 Anaconda Python.我认为 Anaconda Python 可能需要它自己的 lmdb 模块,我关注了 this 链接.lmdb 模块的 Python 安装可以通过在终端中运行命令 pip install lmdb
来执行.然后 import lmdb
在 Python 中就像一个魅力!
Well, the apt-get install liblmdb-dev
might work with bash (in the terminal) but apparently it doesn't work with Anaconda Python. I figured Anaconda Python might require it's own module for lmdb and I followed this link. The Python installation for lmdb module can be performed by running the command pip install lmdb
in the terminal. And then import lmdb
in Python works like a charm!
以上安装命令可能需要sudo.
The above installation commands may require sudo.
这篇关于在 Python 中为 Caffe 创建 LMDB 数据库文件时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!