在Ubuntu上安装pysqlcipher-ImportError

问题描述 投票:0回答:2

从python 2.7开始,我正在开发一个程序,该程序需要对数据库进行加密。这样,我希望将我的意思是pysqlcipher的pysqlite分支安装在Ubuntu上的PC上。我正在关注此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。

谢谢大家对我的帮助!

python encryption sqlite ubuntu-14.04 sqlcipher
2个回答
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#针对系统libsqlcipher构建

您可能会遇到类似以下错误消息:/ usr / bin / ld:找不到...

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

  1. sudo apt-get install autoconf bison构建必需的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构建必需的g ++ g ++-4.8 libbison-dev libc6-dev libsigsegv2 libssl-dev libssl-doc libstdc ++-4.8-dev linux-libc-dev m4 zlib1g-dev

然后结束安装,在终端中输入以下内容:

  • sudo python setup.py安装

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”

© www.soinside.com 2019 - 2024. All rights reserved.