因此,即使pip install pysqlcipher3
工作返回Successfully installed pysqlcipher3
,它也没有。
根据我的研究,对于尝试安装 Sqlcipher 的 Windows 用户来说,这似乎是一个常见问题。
尝试#1
首先,我尝试从 github 下载 pysqlcipher3 并通过 cmd 手动构建和安装它(使用python setup.py build
and python seetup.py install
)。
执行后python3 setup.py build
我遇到了一些错误(缺少一些要求,环境变量中没有 OPENSSL_CONF 等),但我修复了其中的大部分。
但是,我最终遇到了这个错误:
fatal error C1083: Cannot open include file: 'sqlcipher/sqlite3.h': No such file or directory
.
尝试#2
我在某处(我认为)读到我必须在安装PySqlCipher3之前安装SQLCipher。
经过检查,我发现我必须付费才能获得预构建可执行文件或自己构建它。
所以我尝试按照本教程自己构建它。
安装完所有要求并按照步骤操作后,我到达了另一个死胡同。在最后一步之前(第 6 步),执行时nmake /f Makefile.msc
出现此错误:
fatal error C1083: Cannot open include file: 'stdio.h': No such file or directory
我的问题是:
- 我读到我需要
libsqlcipher
这可能是问题所在。我在哪里可以找到它(首选可执行文件的链接)。 - 我如何在第一次尝试时解决这个问题?
- 如何在第二次尝试中解决该问题?
我的目标是:安装并运行 pysqlcipher3。
编辑 1 - 解决了尝试 #2 只是为了解决另一个问题
因此,我似乎在 Visual Studio 中缺少一些 C++ 功能和工具。因此,通过 Visual Studio 社区安装程序,我下载并安装了基本的 C++ 东西,它修复了错误。
我遇到了另一个错误,我通过将OpenSSL-Win64\include
文件夹复制到C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include
.
但是,现在我遇到了这个错误:
sqlite3.c(77701): warning C4389: '!=': signed/unsigned mismatch
lib.exe /NOLOGO /MACHINE:x64 /OUT:libsqlite3.lib sqlite3.lo
echo EXPORTS > sqlcipher.def
dumpbin /all libsqlite3.lib | tclsh .\tool\replace.tcl include "^\s+1 _?(sqlite3(?:session|changeset|changegroup|rebaser)?_[^@]*)(?:@\d+)?$" \1 | sort >> sqlcipher.def
link.exe /DEBUG /NOLOGO /MACHINE:x64 /DLL /DEF:sqlcipher.def /OUT:sqlcipher.dll sqlite3.lo sqlite3res.lo
Creating library sqlcipher.lib and object sqlcipher.exp
sqlite3.lo : error LNK2019: unresolved external symbol RAND_bytes referenced in function sqlcipher_openssl_random
sqlite3.lo : error LNK2019: unresolved external symbol RAND_add referenced in function sqlcipher_openssl_add_random
sqlite3.lo : error LNK2019: unresolved external symbol OBJ_nid2sn referenced in function sqlcipher_openssl_get_cipher
sqlite3.lo : error LNK2019: unresolved external symbol EVP_MD_size referenced in function sqlcipher_openssl_get_hmac_sz
sqlite3.lo : error LNK2019: unresolved external symbol EVP_CIPHER_nid referenced in function sqlcipher_openssl_get_cipher
sqlite3.lo : error LNK2019: unresolved external symbol EVP_CIPHER_block_size referenced in function sqlcipher_openssl_get_block_sz
sqlite3.lo : error LNK2019: unresolved external symbol EVP_CIPHER_key_length referenced in function sqlcipher_openssl_get_key_sz
sqlite3.lo : error LNK2019: unresolved external symbol EVP_CIPHER_iv_length referenced in function sqlcipher_openssl_get_iv_sz
sqlite3.lo : error LNK2019: unresolved external symbol EVP_CipherInit_ex referenced in function sqlcipher_openssl_cipher
sqlite3.lo : error LNK2019: unresolved external symbol EVP_CipherUpdate referenced in function sqlcipher_openssl_cipher
sqlite3.lo : error LNK2019: unresolved external symbol EVP_CipherFinal_ex referenced in function sqlcipher_openssl_cipher
sqlite3.lo : error LNK2019: unresolved external symbol EVP_CIPHER_CTX_new referenced in function sqlcipher_openssl_cipher
sqlite3.lo : error LNK2019: unresolved external symbol EVP_CIPHER_CTX_free referenced in function sqlcipher_openssl_cipher
sqlite3.lo : error LNK2019: unresolved external symbol EVP_CIPHER_CTX_set_padding referenced in function sqlcipher_openssl_cipher
sqlite3.lo : error LNK2019: unresolved external symbol EVP_sha1 referenced in function sqlcipher_openssl_get_hmac_sz
sqlite3.lo : error LNK2019: unresolved external symbol EVP_sha256 referenced in function sqlcipher_openssl_get_hmac_sz
sqlite3.lo : error LNK2019: unresolved external symbol EVP_sha512 referenced in function sqlcipher_openssl_get_hmac_sz
sqlite3.lo : error LNK2019: unresolved external symbol EVP_get_cipherbyname referenced in function sqlcipher_openssl_activate
sqlite3.lo : error LNK2019: unresolved external symbol PKCS5_PBKDF2_HMAC referenced in function sqlcipher_openssl_kdf
sqlite3.lo : error LNK2019: unresolved external symbol HMAC_CTX_new referenced in function sqlcipher_openssl_hmac
sqlite3.lo : error LNK2019: unresolved external symbol HMAC_CTX_free referenced in function sqlcipher_openssl_hmac
sqlite3.lo : error LNK2019: unresolved external symbol HMAC_Init_ex referenced in function sqlcipher_openssl_hmac
sqlite3.lo : error LNK2019: unresolved external symbol HMAC_Update referenced in function sqlcipher_openssl_hmac
sqlite3.lo : error LNK2019: unresolved external symbol HMAC_Final referenced in function sqlcipher_openssl_hmac
sqlcipher.dll : fatal error LNK1120: 24 unresolved externals