【问题标题】:How to build SQL Cipher Python Binding for Windows如何为 Windows 构建 SQL Cipher Python 绑定
【发布时间】:2015-11-09 21:23:52
【问题描述】:

在我的 Windows 机器上为 SQL 密码构建 python 绑定时遇到问题。我已经成功地为 Macintosh 构建了 python 绑定。我想在 Mac 和 PC 上使用我的 python 脚本。

我是 python 新手,不完全理解它为什么会失败,但我开始尝试调试 setup.py 脚本,发现错误在第 147 行的 build_extension(self, ext) 方法中。

我构建的步骤:

  1. https://github.com/rigglemania/pysqlcipher3
  2. https://github.com/sqlcipher/sqlcipher
  3. http://www.jerryrw.com/howtocompile.php

我克隆了上面的存储库,并按照 Jerry 的说明构建 sqlcipher。我把 sqlite3.c 和 sqlite3.h 文件放在你的合并文件夹中,然后我尝试构建合并。我得到了下面的错误。我尝试构建,但也失败并出现同样的错误。

错误:

running build_amalgamation
Builds a C extension using a sqlcipher amalgamation
building 'pysqlcipher3._sqlite3' extension
['path']

问题:

  1. 有什么方法可以在我的 Mac 上构建 sqlcipher 并将其用于 PC? (将文件从 MAC 传输到 PC)?
  2. 谁能帮我为 PC 构建 sqlcipher3 python 绑定?

我是 python 新手,如有任何帮助,将不胜感激。

【问题讨论】:

    标签: python python-3.x distutils sqlcipher pysqlcipher


    【解决方案1】:

    https://github.com/rigglemania/pysqlcipher3

    1) 安装免费的 VS 2015 社区版

    注意:确保选择所有 GCC 选项(VC++、C++ 等)。如果您不确定,请选择所有选项。

    2) 从 https://slproweb.com/products/Win32OpenSSL.html 安装预构建的 OpenSSL 二进制文件(Win32 OpenSSL v1.0.2d 或更高版本)

    3) 确认在环境变量中正确设置了OPENSSL_CONF 环境变量。见 http://www.computerhope.com/issues/ch000549.htm

    注意:这不应该是根 openssl 路径(例如:C:/openssl-Win32),而应该是配置文件的路径(例如:C:/openssl-Win32/bin/openssl.cfg)

    4) 将(C:/OpenSSL-Win32/include/openssl)目录下的openssl文件夹复制到VC的include目录下(ex: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/include)

    注意:确认以下路径存在(../../VC/include/openssl/aes.h)

    5) 安装 Python 3.5(32 位)。

    注意:如果您安装了 python 64 位,您可能需要在安装 python 32 位之前将其卸载。

    6) 使用 SQL Cipher 3 合并,或者您可以按照本教程 http://www.jerryrw.com/howtocompile.php 编译最新的 SQL Cipher 合并。

    7) 点击开始、运行、cmd。在 CMD 提示中导航到您签出此存储库的文件夹。运行“python setup.py build_amalgamation”

    8) 运行“python setup.py install”。通过尝试解密数据库来测试新库。

    注意:如果解密失败,请检查您是否拥有正确的合并文件。

    【讨论】:

      猜你喜欢
      • 2017-09-23
      • 1970-01-01
      • 1970-01-01
      • 2018-06-30
      • 1970-01-01
      • 1970-01-01
      • 2022-01-16
      • 2020-11-11
      • 1970-01-01
      相关资源
      最近更新 更多