在Ubuntu上安装pysqlcipher - ImportError

时间:2015-03-03 09:35:54

标签: python encryption sqlite ubuntu-14.04 sqlcipher

从python 2.7开始,我开发了一个需要加密数据库的程序。这样,我希望在我的PC上安装,使用Ubuntu,pysqlite的分支我的意思是pysqlcipher。我跟随此tutorial但是当我在终端中输入此代码时:

python setup.py build_sqlcipher

我收到此错误消息:

Traceback (most recent call last):
  File "setup.py", line 38, in <module>
    import setuptools
ImportError: No module named setuptools

我不明白,因为我已经安装了setuptools。

感谢大家的帮助!

2 个答案:

答案 0 :(得分:0)

要在Ubuntu 14.04LTS 上安装 sqlcipher,您必须使用 Python 2.7 。然后,我按照以下步骤进入了终端:

  1. sudo apt-get install sqlite3
  2. sudo apt-get install libsqlite3-dev
  3. git clone https://github.com/leapcode/pysqlcipher/
  4. cd pysqlcipher
  5. python setup.py build_sqlcipher#build the system libsqlcipher
  6. 您可能会遇到如下错误消息: / usr / bin / ld:找不到...

    我用来跳过此问题的一个解决方案是运行:

    1. sudo apt-get install autoconf bison build-essential libssl-dev libyaml-dev libreadline6 libreadline6-dev zlib1g zlib1g-dev
    2. automake autotools-dev g ++ g ++ - 4.8 libbison-dev libc6-dev libsigsegv2 libssl-doc libstdc ++ - 4.8-dev linux-libc-dev m4
    3. autoconf automake autotools-dev bison build-essential g ++ g ++ - 4.8 libbison-dev libc6-dev libsigsegv2 libssl-dev libssl-doc libstdc ++ - 4.8-dev linux-libc-dev m4 zlib1g-dev
    4. 然后结束安装,在终端输入:

      • sudo python setup.py install

答案 1 :(得分:0)

针对捆绑的libsqlcipher构建

默认行为是针对系统中的libsqlcipher进行链接。

为方便起见,此软件包在常规安装期间包括sqlcipher合并。参见https://www.sqlite.org/amalgamation.html

如果系统中未安装sqlcipher,则可以使用捆绑的pysqlcipher:

python setup.py install --bundled

您还可以传递先前下载的其他合并路径:

python setup.py install --bundled --amalgamation = / tmp / path / to / amalgamation

如果您是从pip安装的,但由于某些原因您更喜欢使用捆绑的sqlcipher,则应将选项传递给以下用户:

pip install pysqlcipher --install-option =“-bundled”