因此,尽管pip install pysqlcipher3
工作返回了Successfully installed pysqlcipher3
,但事实并非如此。
从我的研究来看,这似乎是Windows用户试图安装user密码的一个常见问题。
尝试#1
首先,我尝试从github下载pysqlcipher3,并通过cmd手动构建和安装它(使用python setup.py build
和python seetup.py install
)。
在执行python3 setup.py build
时,我得到了一些错误(缺少一些需求,在环境variable...etc中没有OPENSSL_CONF )。但我修了大部分。
但是,我最终还是遇到了这个错误:
fatal error C1083: Cannot open include file: 'sqlcipher/sqlite3.h': No such file or directory
。
尝试#2
我在某个地方(我想)读到,在安装SQLCipher之前,必须先安装PySqlCipher3。
经过检查,我发现我要么要付钱才能得到预构建的可执行文件,要么自己构建它。
因此,我试图在本教程之后自己构建它。
在安装完所有需求之后,按照下面的步骤,我将到达另一个死胡同。在前面的最后一步(步骤6)中,当执行nmake /f Makefile.msc
时,我得到了以下错误:
fatal error C1083: Cannot open include file: 'stdio.h': No such file or directory
我的问题是:
libsqlcipher
,这可能是问题所在。我可以在哪里找到它(链接到可执行的首选)。我的目标是:安装和工作pysqlcipher3。
编辑1已解决的尝试#2只是为了达到另一个问题
因此,在Visual中,我似乎缺少了一些C++特性和工具。因此,通过,我下载并安装了基本的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
发布于 2019-10-17 06:13:58
首先,"Successfully installed pysqlcipher3"
具有误导性(至少到目前Github储存库上的最新版本)。我只是浪费了我自己的一些时间,我想我应该再次表明这一点。
误导的"Successfully installed pysqlcipher3"
也出现在Linux系统上。如果您手头有一个Ubuntu/Debian系统,下面的内容可以帮助您运行。基本上,您需要在SQLCipher
命令之前安装pip3
库和开发文件。
$ sudo apt install sqlcipher libsqlcipher0 libsqlcipher-dev
$ sudo -H pip3 install pysqlcipher3
$ python3 -c 'import pysqlcipher3; print(pysqlcipher3.__path__)'
['/usr/local/lib/python3.7/dist-packages/pysqlcipher3']
由于您在Windows上,所以unresolved external symbol RAND_bytes
(编译器/链接器错误的第一行)基本上意味着您在Windows上的链接器找不到必要的OpenSSL
库。
查看这里、这里和这里的帖子。他们有解决这个确切的OpenSSL链接问题的解决方案。解决问题的基本步骤如下:
OpenSSL
包括目录,例如C:\OpenSSL-Win32\include
OpenSSL
库目录,例如C:\OpenSSL-Win32\lib
- libeay32.lib
- libeay32MTd.lib
- libeay32MT.lib
- libeay32MDd.lib
- libeay32MD.lib
- ssleay32.lib
- ssleay32MTd.lib
- ssleay32MT.lib
- ssleay32MDd.lib
- ssleay32MD.lib
发布于 2020-05-19 08:49:16
我也有你几乎所有的问题,所以我创建了下面的指南,为我工作。
我的构建: windows 10 x64 v1909
SET OPENSSL_CONF=C:\OpenSSL-Win64\bin\openssl.cfg
添加环境变量(按您的更改路径)sqlcipher
的上述解压缩目录。nmake /f Makefile.msc
。最后的编译会报告一个错误,但没关系,我们这里不需要真正的编译,只需要sqlite3.c
。amalgamation
的文件夹,并在amalgamation
文件夹中创建另一个名为sqlcipher
的文件夹sqlite3.h
和sqlite3.c
(在sqlcipher-master
文件夹中)复制到amalgamation
文件夹和sqlcipher
文件夹pysqlcipher3-1.0.3
目录python setup.py build_amalgamation
python setup.py build_amalgamation
。这一次,它应该运行良好,没有任何错误。python setup.py install
from pysqlcipher3 import dbapi2
中工作。如果你没有得到准确的版本,因为我的链接在未来打破,你可以评论,如果我有他们在那个时候,我会上传到一个云驱动器。
更新27-APR-2021用于Pythonv3.9.4 x64
MODULE_NAME
在编译前没有进行正确的分析,正如@ properly 30在注释中指出的那样。错误如下:
src\python3 3\cache.c(261):错误C2017:非法转义序列
1.2。由于删除了python版本3.9中的一些函数的功能MODULE_NAME
中的所有pysqlcipher3-1.0.4/src/python3
替换为pysqlcipher3.dbapi2
,从而解决了这个问题。pysqlcipher3 1.0.4
刚刚发布了几天前(4月25日至21日)已经解决了这个问题,并提供了替代品。因此,最好是使用pysqlcipher3 1.0.4
的源文件,而不是像上面第9点所做的那样使用pysqlcipher3 1.0.3
。发布于 2020-05-23 17:58:19
在运行Catalina macOS 10.15.4的iMac上,当我试图安装pysqlcipher3时,它会发出错误消息
但后来我跑了
$ brew install SQLCipher
它成功地发挥了作用:
$ brew install SQLCipher
==> Downloading https://homebrew.bintray.com/bottles/sqlcipher-4.4.0.catalina.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/9e/9e860b50ec668ef30f61377f39954241c4eeda4c4a664fbe1340e289229336bf?__gda__=exp=1590256907~hmac=9bb692e78355e890ab
######################################################################## 100.0%
==> Pouring sqlcipher-4.4.0.catalina.bottle.tar.gz
/usr/local/Cellar/sqlcipher/4.4.0: 13 files, 3.9MB
现在,当我第二次尝试安装pysqlcipher3时,它也成功地安装了:
$ pip3 install pysqlcipher3
Collecting pysqlcipher3
Using cached pysqlcipher3-1.0.3.tar.gz (100 kB)
Building wheels for collected packages: pysqlcipher3
Building wheel for pysqlcipher3 (setup.py) ... done
Created wheel for pysqlcipher3: filename=pysqlcipher3-1.0.3-cp37-cp37m-macosx_10_15_x86_64.whl size=61077 sha256=28e480d5999a13cf2446a262cff9d746853d0bf90541a76e473f66a7128ff877
Stored in directory: /Users/kitzume/Library/Caches/pip/wheels/91/30/b9/1ee85dc50cddf37ecb5198dfa6279aa72eeb0148063b5ad0c6
Successfully built pysqlcipher3
Installing collected packages: pysqlcipher3
Successfully installed pysqlcipher3-1.0.3
https://stackoverflow.com/questions/55446420
复制相似问题