VS2008 编译SQLite 3.8.4.3 + sqlcipher-3.1.0 + openssl-1.0.1g

本文详细介绍了如何使用SQLCipher库实现SQLite数据库文件的256位AES加密过程,包括下载源码、编译openssl、创建win32dll项目、集成加密功能及使用方法等步骤。

SQLCipher是一个开源库,提供透明,安全的256位AES加密的SQLite数据库文件。
SQLCipher的社区版的源代码是一个BSD-风格的开源许可下发布,但是官方提供的二进制库需要购买。

引用官方的一张图,加密前和加密后的对比效果:

1、先下载以下源码文件
SQLite 3.8.4.3 源码

http://www.sqlite.org/2014/sqlite-amalgamation-3080403.zip

sqlite3.def 文件

http://www.sqlite.org/2014/sqlite-dll-win32-x86-3080403.zip

sqlcipher-3.1.0 源码

https://github.com/sqlcipher/sqlcipher/archive/v3.1.0.zip

openssl-1.0.1g源码 已修复 CVE-2014-0160 漏洞

http://www.openssl.org/source/openssl-1.0.1g.tar.gz

2、编译openssl-1.0.1g
系统先要 activeperl 配置openssl 的时候需要调用 http://www.activestate.com/activeperl。
解压源码包进入openssl-1.0.1g目录新键一个build.bat 文件内容如下:


01@echo off
02@set OPTS=no-asm
03@perl Configure VC-WIN32
04@perl util\mkfiles.pl >MINFO
05@perl util\mk1mf.pl %OPTS% debug VC-WIN32 >d32.mak
06@perl util\mk1mf.pl %OPTS% VC-WIN32 >32.mak
07@perl util\mkdef.pl 32 libeay > ms\libeay32.def
08@perl util\mkdef.pl 32 ssleay > ms\ssleay32.def
09@nmake -f d32.mak
10@nmake -f 32.mak

 

然后使用VC命令行进入openssl-1.0.1g目录运行 build.bat 就开始编译并生成 libeay32.lib ssleay32.lib;

3、编译SQLite 创建一个空的win32 dll项目,将解压缩的文件添加进来,进行编译,项目属性–配置属性–连接器–输入–模块定义文件,添加sqlite3.def,和附加依赖项添加 libeay32.lib ssleay32.lib。

在sqlite3.def 文件最后添加以下代码


1sqlite3_key
2sqlite3_rekey

 

在sqlite3.cpp 文件最前添加以下代码


1/*** START REQUIRED BY SQLCIPHER ***/
2#define SQLITE_HAS_CODEC
3#define SQLITE_ENABLE_RTREE
4#define SQLITE_ENABLE_COLUMN_METADATA
5#define SQLITE_TEMP_STORE 2
6/*** END REQUIRED BY SQLCIPHER ***/

 

然后拉到最后添加以下代码


1#include <sqlcipher/crypto.c>      /*** SQLCIPHER ADDITION ***/
2#include <sqlcipher/crypto_cc.c>      /*** SQLCIPHER ADDITION ***/
3#include <sqlcipher/crypto_impl.c> /*** SQLCIPHER ADDITION ***/
4#include <sqlcipher/crypto_openssl.c> /*** SQLCIPHER ADDITION ***/
5#include <sqlcipher/pager.c>       /*** SQLCIPHER ADDITION ***/

 

以上文件 里的这些头文件注示掉
/*#include “sqliteInt.h”*/
/*#include “btreeInt.h”*/

pager.c文件的内容为


01/* BEGIN CRYPTO */
02#ifdef SQLITE_HAS_CODEC
03void sqlite3pager_get_codec(Pager *pPager, void **ctx) {
04    *ctx = pPager->pCodec;
05}
06 
07int sqlite3pager_is_mj_pgno(Pager *pPager, Pgno pgno) {
08    return (PAGER_MJ_PGNO(pPager) == pgno) ? 1 : 0;
09}
10 
11sqlite3_file *sqlite3Pager_get_fd(Pager *pPager) {
12    return (isOpen(pPager->fd)) ? pPager->fd : NULL;
13}
14 
15void sqlite3pager_sqlite3PagerSetCodec(
16                                       Pager *pPager,
17                                       void *(*xCodec)(void*,void*,Pgno,int),
18                                       void (*xCodecSizeChng)(void*,int,int),
19                                       void (*xCodecFree)(void*),
20                                       void *pCodec
21                                       ){
22                                           sqlite3PagerSetCodec(pPager, xCodec, xCodecSizeChng, xCodecFree, pCodec);
23}
24 
25void sqlite3pager_sqlite3PagerSetError( Pager *pPager, int error) {
26    pPager->errCode = error;
27}
28 
29#endif
30/* END CRYPTO */

 

然后再编译可以成功生成sqlite3.dll

4、
使用方法


01#include "sqlite3.h"
02#include <stdio.h>
03 
04#define ERROR(X)  {printf("[ERROR] iteration %d: ", i); printf X;fflush(stdout);}
05 
06int main(int argc, char **argv) {
07  sqlite3 *db;
08  const char *file= "sqlcipher.db";
09 
10  const char *key1 = "test123";
11  char* key = (char *) key1;
12 
13    if (sqlite3_open(file, &db) == SQLITE_OK) {
14      int row, rc, master_rows;
15      sqlite3_stmt *stmt;
16       
17      if(db == NULL) {
18        ERROR(("sqlite3_open reported OK, but db is null, retrying open %s\n", sqlite3_errmsg(db)))
19      }
20  
21      if(sqlite3_key(db, key, strlen(key)) != SQLITE_OK) {
22    ERROR(("error setting key %s\n", sqlite3_errmsg(db)))
23        exit(1);
24      }
25//SQLlite 操作代码...
26 
27}
conda update -n base -c conda-forge conda --yes Solving environment: failed CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://repo.anaconda.com/pkgs/free/linux-64/repodata.json.bz2> Elapsed: - An HTTP error occurred when trying to retrieve this URL. HTTP errors are often intermittent, and a simple retry will get you on your way. If your current network has https://www.anaconda.com blocked, please file a support request with your network engineering team. ConnectionError(MaxRetryError("HTTPSConnectionPool(host=&#39;repo.anaconda.com&#39;, port=443): Max retries exceeded with url: /pkgs/free/linux-64/repodata.json.bz2 (Caused by NewConnectionError(&#39;<urllib3.connection.VerifiedHTTPSConnection object at 0x2b165a4e3128>: Failed to establish a new connection: [Errno -2] Name or service not known&#39;))")) [scb3201@ln137%bscc-a6 ~]$ # 测试安装常用包 [scb3201@ln137%bscc-a6 ~]$ conda install -c conda-forge numpy pandas Solving environment: failed CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://repo.anaconda.com/pkgs/r/noarch/repodata.json.bz2> Elapsed: - An HTTP error occurred when trying to retrieve this URL. HTTP errors are often intermittent, and a simple retry will get you on your way. If your current network has https://www.anaconda.com blocked, please file a support request with your network engineering team. ConnectionError(MaxRetryError("HTTPSConnectionPool(host=&#39;repo.anaconda.com&#39;, port=443): Max retries exceeded with url: /pkgs/r/noarch/repodata.json.bz2 (Caused by NewConnectionError(&#39;<urllib3.connection.VerifiedHTTPSConnection object at 0x2ba3d9347be0>: Failed to establish a new connection: [Errno -2] Name or service not known&#39;))")) [scb3201@ln137%bscc-a6 ~]$ [scb3201@ln137%bscc-a6 ~]$ # 检查环境状态 [scb3201@ln137%bscc-a6 ~]$ conda list --revisions 2018-11-08 03:08:33 (rev 0) +_ipyw_jlab_nb_ext_conf-0.1.0 +alabaster-0.7.11 +anaconda-5.3.1 +anaconda-client-1.7.2 +anaconda-navigator-1.9.2 +anaconda-project-0.8.2 +appdirs-1.4.3 +asn1crypto-0.24.0 +astroid-2.0.4 +astropy-3.0.4 +atomicwrites-1.2.1 +attrs-18.2.0 +automat-0.7.0 +babel-2.6.0 +backcall-0.1.0 +backports-1.0 +backports.shutil_get_terminal_size-1.0.0 +beautifulsoup4-4.6.3 +bitarray-0.8.3 +bkcharts-0.2 +blas-1.0 +blaze-0.11.3 +bleach-2.1.4 +blosc-1.14.4 +bokeh-0.13.0 +boto-2.49.0 +bottleneck-1.2.1 +bzip2-1.0.6 +ca-certificates-2018.03.07 +cairo-1.14.12 +certifi-2018.8.24 +cffi-1.11.5 +chardet-3.0.4 +click-6.7 +cloudpickle-0.5.5 +clyent-1.2.2 +colorama-0.3.9 +conda-4.5.11 +conda-build-3.15.1 +conda-env-2.6.0 +constantly-15.1.0 +contextlib2-0.5.5 +cryptography-2.3.1 +curl-7.61.0 +cycler-0.10.0 +cython-0.28.5 +cytoolz-0.9.0.1 +dask-0.19.1 +dask-core-0.19.1 +datashape-0.5.4 +dbus-1.13.2 +decorator-4.3.0 +defusedxml-0.5.0 +distributed-1.23.1 +docutils-0.14 +entrypoints-0.2.3 +et_xmlfile-1.0.1 +expat-2.2.6 +fastcache-1.0.2 +filelock-3.0.8 +flask-1.0.2 +flask-cors-3.0.6 +fontconfig-2.13.0 +freetype-2.9.1 +fribidi-1.0.5 +get_terminal_size-1.0.0 +gevent-1.3.6 +glib-2.56.2 +glob2-0.6 +gmp-6.1.2 +gmpy2-2.0.8 +graphite2-1.3.12 +greenlet-0.4.15 +gst-plugins-base-1.14.0 +gstreamer-1.14.0 +h5py-2.8.0 +harfbuzz-1.8.8 +hdf5-1.10.2 +heapdict-1.0.0 +html5lib-1.0.1 +hyperlink-18.0.0 +icu-58.2 +idna-2.7 +imageio-2.4.1 +imagesize-1.1.0 +incremental-17.5.0 +intel-openmp-2019.0 +ipykernel-4.9.0 +ipython-6.5.0 +ipython_genutils-0.2.0 +ipywidgets-7.4.1 +isort-4.3.4 +itsdangerous-0.24 +jbig-2.1 +jdcal-1.4 +jedi-0.12.1 +jeepney-0.3.1 +jinja2-2.10 +jpeg-9b +jsonschema-2.6.0 +jupyter-1.0.0 +jupyter_client-5.2.3 +jupyter_console-5.2.0 +jupyter_core-4.4.0 +jupyterlab-0.34.9 +jupyterlab_launcher-0.13.1 +keyring-13.2.1 +kiwisolver-1.0.1 +lazy-object-proxy-1.3.1 +libcurl-7.61.0 +libedit-3.1.20170329 +libffi-3.2.1 +libgcc-ng-8.2.0 +libgfortran-ng-7.3.0 +libpng-1.6.34 +libsodium-1.0.16 +libssh2-1.8.0 +libstdcxx-ng-8.2.0 +libtiff-4.0.9 +libtool-2.4.6 +libuuid-1.0.3 +libxcb-1.13 +libxml2-2.9.8 +libxslt-1.1.32 +llvmlite-0.24.0 +locket-0.2.0 +lxml-4.2.5 +lzo-2.10 +markupsafe-1.0 +matplotlib-2.2.3 +mccabe-0.6.1 +mistune-0.8.3 +mkl-2019.0 +mkl-service-1.1.2 +mkl_fft-1.0.4 +mkl_random-1.0.1 +more-itertools-4.3.0 +mpc-1.1.0 +mpfr-4.0.1 +mpmath-1.0.0 +msgpack-python-0.5.6 +multipledispatch-0.6.0 +navigator-updater-0.2.1 +nbconvert-5.4.0 +nbformat-4.4.0 +ncurses-6.1 +networkx-2.1 +nltk-3.3.0 +nose-1.3.7 +notebook-5.6.0 +numba-0.39.0 +numexpr-2.6.8 +numpy-1.15.1 +numpy-base-1.15.1 +numpydoc-0.8.0 +odo-0.5.1 +olefile-0.46 +openpyxl-2.5.6 +openssl-1.0.2p +packaging-17.1 +pandas-0.23.4 +pandoc-1.19.2.1 +pandocfilters-1.4.2 +pango-1.42.4 +parso-0.3.1 +partd-0.3.8 +patchelf-0.9 +path.py-11.1.0 +pathlib2-2.3.2 +patsy-0.5.0 +pcre-8.42 +pep8-1.7.1 +pexpect-4.6.0 +pickleshare-0.7.4 +pillow-5.2.0 +pip-10.0.1 +pixman-0.34.0 +pkginfo-1.4.2 +pluggy-0.7.1 +ply-3.11 +prometheus_client-0.3.1 +prompt_toolkit-1.0.15 +psutil-5.4.7 +ptyprocess-0.6.0 +py-1.6.0 +pyasn1-0.4.4 +pyasn1-modules-0.2.2 +pycodestyle-2.4.0 +pycosat-0.6.3 +pycparser-2.18 +pycrypto-2.6.1 +pycurl-7.43.0.2 +pyflakes-2.0.0 +pygments-2.2.0 +pylint-2.1.1 +pyodbc-4.0.24 +pyopenssl-18.0.0 +pyparsing-2.2.0 +pyqt-5.9.2 +pysocks-1.6.8 +pytables-3.4.4 +pytest-3.8.0 +pytest-arraydiff-0.2 +pytest-astropy-0.4.0 +pytest-doctestplus-0.1.3 +pytest-openfiles-0.3.0 +pytest-remotedata-0.3.0 +python-3.7.0 +python-dateutil-2.7.3 +pytz-2018.5 +pywavelets-1.0.0 +pyyaml-3.13 +pyzmq-17.1.2 +qt-5.9.6 +qtawesome-0.4.4 +qtconsole-4.4.1 +qtpy-1.5.0 +readline-7.0 +requests-2.19.1 +rope-0.11.0 +ruamel_yaml-0.15.46 +scikit-image-0.14.0 +scikit-learn-0.19.2 +scipy-1.1.0 +seaborn-0.9.0 +secretstorage-3.1.0 +send2trash-1.5.0 +service_identity-17.0.0 +setuptools-40.2.0 +simplegeneric-0.8.1 +singledispatch-3.4.0.3 +sip-4.19.8 +six-1.11.0 +snappy-1.1.7 +snowballstemmer-1.2.1 +sortedcollections-1.0.1 +sortedcontainers-2.0.5 +sphinx-1.7.9 +sphinxcontrib-1.0 +sphinxcontrib-websupport-1.1.0 +spyder-3.3.1 +spyder-kernels-0.2.6 +sqlalchemy-1.2.11 +sqlite-3.24.0 +statsmodels-0.9.0 +sympy-1.2 +tblib-1.3.2 +terminado-0.8.1 +testpath-0.3.1 +tk-8.6.8 +toolz-0.9.0 +tornado-5.1 +tqdm-4.26.0 +traitlets-4.3.2 +twisted-18.7.0 +unicodecsv-0.14.1 +unixodbc-2.3.7 +urllib3-1.23 +wcwidth-0.1.7 +webencodings-0.5.1 +werkzeug-0.14.1 +wheel-0.31.1 +widgetsnbextension-3.4.1 +wrapt-1.10.11 +xlrd-1.1.0 +xlsxwriter-1.1.0 +xlwt-1.3.0 +xz-5.2.4 +yaml-0.1.7 +zeromq-4.2.5 +zict-0.1.3 +zlib-1.2.11 +zope-1.0 +zope.interface-4.5.0 [scb3201@ln137%bscc-a6 ~]$ conda info active environment : base active env location : /public1/home/scb3201/anaconda3 shell level : 1 user config file : /public1/home/scb3201/.condarc populated config files : /public1/home/scb3201/.condarc conda version : 4.5.11 conda-build version : 3.15.1 python version : 3.7.0.final.0 base environment : /public1/home/scb3201/anaconda3 (writable) channel URLs : https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/linux-64 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/noarch https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/linux-64 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/noarch https://repo.anaconda.com/pkgs/main/linux-64 https://repo.anaconda.com/pkgs/main/noarch https://repo.anaconda.com/pkgs/free/linux-64 https://repo.anaconda.com/pkgs/free/noarch https://repo.anaconda.com/pkgs/r/linux-64 https://repo.anaconda.com/pkgs/r/noarch https://repo.anaconda.com/pkgs/pro/linux-64 https://repo.anaconda.com/pkgs/pro/noarch package cache : /public1/home/scb3201/anaconda3/pkgs /public1/home/scb3201/.conda/pkgs envs directories : /public1/home/scb3201/anaconda3/envs /public1/home/scb3201/.conda/envs platform : linux-64 user-agent : conda/4.5.11 requests/2.19.1 CPython/3.7.0 Linux/3.10.0-1160.118.1.el7.x86_64 centos/7 glibc/2.17 UID:GID : 4238:4238 netrc file : None offline mode : False [scb3201@ln137%bscc-a6 ~]$ curl -v https://repo.anaconda.com/pkgs/r/linux-64/repodata.json.bz2 * Could not resolve host: repo.anaconda.com * Closing connection 0 curl: (6) Could not resolve host: repo.anaconda.com [scb3201@ln137%bscc-a6 ~]$ curl -I https://repo.anaconda.com/pkgs/r/linux-64/repodata.json.bz2 curl: (6) Could not resolve host: repo.anaconda.com [scb3201@ln137%bscc-a6 ~]$ echo $http_proxy # 检查代理变量 [scb3201@ln137%bscc-a6 ~]$ ping 8.8.8.8 # 测试基础网络连通性 PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
最新发布
11-24
#异步相关依赖 aiofiles==24.1.0 aiohappyeyeballs==2.4.6 aiohttp==3.11.12 aioprometheus==23.12.0 aiosignal==1.3.2 async-timeout==4.0.3 frozenlist==1.5.0 multidict==6.1.0 yarl==1.18.3 #数据处理与可视化 altair==4.2.2 contourpy==1.3.1 cycler==0.12.1 matplotlib==3.10.0 numpy==1.24.4 pandas==1.5.3 pillow==10.4.0 pyparsing==3.2.1 scipy==1.15.3 seaborn==0.13.2 tabulate==0.9.0 #Web 框架与接口 anyio==4.8.0 fastapi==0.109.2 fastapi-mcp==0.3.4 fastjsonschema==2.21.1 h11==0.14.0 httpcore==1.0.7 httptools==0.6.4 httpx==0.27.2 httpx-sse==0.4.0 pydantic==2.7.4 pydantic_core==2.18.4 pydantic-extra-types==2.10.2 pydantic-settings==2.9.1 starlette>=0.36.3,<0.37.0 sse-starlette==1.8.2 uvicorn==0.34.0 websockets==14.2 #LangChain 生态(100% 无冲突,Python 3.10 验证通过) #核心调整:降低 langchain 主版本至 0.2.16,同步匹配子库版本,避免 core 版本交叉冲突 langchain==0.2.16 # 降至 0.2.16(依赖 core≥0.2.36<0.3.0,兼容范围更广) langchain-community==0.2.18 # 与 langchain==0.2.16 匹配,依赖 core≥0.2.36<0.3.0 langchain-core==0.2.43 # 保持 0.2.x 最高稳定版,同时满足所有子库要求 langchain-experimental==0.0.64 # 降至 0.0.640.0.65 依赖更高 core,0.0.64 兼容 core≥0.2.36) langchain-openai==0.2.4 # 降至 0.2.4(依赖 core≥0.2.36<0.3.0,与 core==0.2.43 完美兼容) langchain-text-splitters==0.2.3 # 降至 0.2.30.2.4 依赖 core≥0.2.43,此处保持版本统一) langchainhub==0.1.19 # 无 core 版本冲突,保持不变 langsmith==0.1.147 # 无 core 版本冲突,保持不变 #文档处理与解析 beautifulsoup4==4.13.3 docx2txt==0.8 et_xmlfile==2.0.0 favicon==0.7.0 filetype==1.2.0 lxml==5.3.1 markdown-it-py==3.0.0 markdownify==0.14.1 markdownlit==0.0.7 openpyxl==3.1.4 pydub==0.25.1 PyMuPDF==1.23.26 PyMuPDFb==1.23.22 pypdf==5.3.0 python-docx==1.1.2 soupsieve==2.6 unstructured==0.11.8 unstructured-client==0.25.9 #模型与推理相关(适配 Python 3.10) faiss-cpu==1.7.4 huggingface-hub==0.32.1 modelscope==1.18.0 onnxruntime==1.15.1 openai==1.61.1 safetensors==0.5.3 tiktoken==0.8.0 torch==2.7.0 torchvision==0.22.0 xinference-client==1.6.0 xoscar==0.7.2 #数据库与存储 PyMySQL==1.1.1 pyarrow==19.0.0 SQLAlchemy==2.0.38 #工具类与辅助依赖(Python 3.10 兼容) annotated-types==0.7.0 backoff==2.2.1 backports.tarfile==1.2.0 bcrypt==4.3.0 blinker==1.9.0 Brotli==1.1.0 build==1.2.2.post1 CacheControl==0.14.2 cachetools==5.5.1 certifi==2025.1.31 cffi==1.17.1 chardet==5.2.0 charset-normalizer==3.4.1 cleo==2.1.0 click==8.1.8 cloudpickle==3.1.1 colorama==0.4.6 coloredlogs==15.0.1 crashtest==0.4.1 cryptography==44.0.0 dataclasses-json==0.6.7 deepdiff==8.2.0 deprecation==2.1.0 distlib==0.3.9 distro==1.9.0 dnspython==2.7.0 dulwich==0.22.7 ecdsa==0.19.1 elastic-transport==8.17.0 elasticsearch==8.4.3 email_validator==2.2.0 emoji==2.14.1 entrypoints==0.4 exceptiongroup==1.2.2 Faker==36.1.0 ffmpy==0.5.0 filelock==3.17.0 flatbuffers==25.2.10 fonttools==4.56.0 fsspec==2025.5.1 gitdb==4.0.12 GitPython==3.1.44 greenlet==3.1.1 groovy==0.1.2 h2==4.2.0 hpack==4.1.0 htbuilder==0.9.0 humanfriendly==10.0 hyperframe==6.1.0 idna==3.10 importlib_metadata==8.6.1 installer==0.7.0 itsdangerous==2.2.0 jaraco.classes==3.4.0 jaraco.context==6.0.1 jaraco.functools==4.1.0 jieba==0.42.1 Jinja2==3.1.5 jiter==0.8.2 joblib==1.4.2 jsonpatch==1.33 jsonpath-python==1.0.6 jsonpointer==3.0.0 jsonschema==4.23.0 jsonschema-specifications==2024.10.1 keyring==25.6.0 kiwisolver==1.4.8 langdetect==1.0.9 loguru==0.7.3 Markdown==3.7 MarkupSafe==3.0.2 marshmallow==3.26.1 mcp==1.9.0 mdurl==0.1.2 memoization==0.4.0 more-itertools==10.6.0 mpmath==1.3.0 msgpack==1.1.0 mypy-extensions==1.0.0 nest-asyncio==1.6.0 networkx==3.1 nltk==3.8.1 numexpr==2.10.2 nvidia-ml-py==12.575.51 opencv-python==4.10.0.84 orderly-set==5.3.0 orjson==3.10.15 packaging==23.2 passlib==1.7.4 pathlib==1.0.1 pika==1.3.2 pip==25.0 pkginfo==1.12.0 platformdirs==4.3.6 poetry==2.0.1 poetry-core==2.0.1 prometheus_client==0.21.1 propcache==0.2.1 protobuf==4.25.6 psutil==7.0.0 pyahocorasick==2.1.0 pyasn1==0.4.8 pyclipper==1.3.0.post6 pycparser==2.22 pydeck==0.9.1 Pygments==2.19.1 PyJWT==2.8.0 pymdown-extensions==10.14.3 pynvml==12.0.0 pypandoc==1.15 pyproject_hooks==1.2.0 pyreadline3==3.5.4 python-dateutil==2.9.0.post0 python-decouple==3.8 python-dotenv==1.0.1 python-iso639==2025.2.8 python-jose==3.4.0 python-magic==0.4.27 python-multipart==0.0.20 pytz==2025.1 PyYAML==6.0.2 quantile-python==1.1 rank-bm25==0.2.2 RapidFuzz==3.12.1 rapidocr-onnxruntime==1.3.25 referencing==0.36.2 regex==2024.11.6 requests==2.31.0 requests-toolbelt==1.0.0 rich==13.9.4 rpds-py==0.22.0 rsa==4.9.1 ruamel.yaml==0.18.6 ruamel.yaml.clib==0.2.12 ruff==0.11.11 semantic-version==2.10.0 setproctitle==1.3.6 setuptools==75.8.0 shapely==2.0.7 shellingham==1.5.4 simplejson==3.19.3 six==1.17.0 smmap==5.0.2 sniffio==1.3.1 socksio==1.0.0 st-annotated-text==4.0.2 streamlit==1.34.0 streamlit-aggrid==1.0.5 streamlit-antd-components==0.3.1 streamlit-camera-input-live==0.2.0 streamlit-card==1.0.2 streamlit-chatbox==1.1.8 streamlit-embedcode==0.1.2 streamlit-extras==0.4.2 streamlit-faker==0.0.3 streamlit-feedback==0.1.4 streamlit-image-coordinates==0.1.9 streamlit-keyup==0.3.0 streamlit_modal==0.1.0 streamlit-option-menu==0.3.12 streamlit-paste-button==0.1.2 streamlit-toggle-switch==1.0.2 streamlit-vertical-slider==2.5.5 strsimpy==0.2.1 sympy==1.13.3 tblib==3.1.0 tenacity==8.5.0 toml==0.10.2 tomli==2.2.1 tomlkit==0.13.2 toolz==1.0.0 tornado==6.4.2 tqdm==4.67.1 trove-classifiers==2025.1.15.22 typer==0.15.4 types-requests==2.32.0.20241016 typing_extensions==4.12.2 typing-inspect==0.9.0 typing-inspection==0.4.0 tzdata==2025.1 ujson==5.10.0 urllib3==2.3.0 validators==0.34.0 virtualenv==20.29.2 watchdog==6.0.0 watchfiles==1.0.4 win32_setctime==1.2.0 wrapt==1.17.2 zipp==3.21.0 以上依赖 出现不兼容 环境Python 3.10.0 liunx
09-11
(base) C:\Users\DELL>conda create -n tensorflow-cpu python=3.7.4 Collecting package metadata (current_repodata.json): done Solving environment: failed with current_repodata.json, will retry with next repodata source. Collecting package metadata (repodata.json): done Solving environment: done ==> WARNING: A newer version of conda exists. <== current version: 4.7.10 latest version: 25.9.1 Please update conda by running $ conda update -n base -c defaults conda WARNING conda.core.package_cache_data:_make_single_record(350): Encountered corrupt package tarball at E:\anaconda\pkgs\libgrpc-1.71.0-hf4237ab_0.conda. Conda has removed it, but you need to re-run conda to download it again. WARNING conda.core.package_cache_data:_make_single_record(350): Encountered corrupt package tarball at E:\anaconda\pkgs\mkl-2025.0.0-h5da7b33_930.conda. Conda has removed it, but you need to re-run conda to download it again. ## Package Plan ## environment location: E:\anaconda\envs\tensorflow-cpu added / updated specs: - python=3.7.4 The following packages will be downloaded: package | build ---------------------------|----------------- certifi-2022.12.7 | py37haa95532_0 149 KB https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main openssl-1.1.1w | h2bbff1b_0 5.5 MB https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main pip-22.3.1 | py37haa95532_0 2.7 MB https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main python-3.7.4 | h5263a28_0 14.7 MB https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main setuptools-65.6.3 | py37haa95532_0 1.1 MB https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main wheel-0.38.4 | py37haa95532_0 82 KB https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main wincertstore-0.2 | py37haa95532_2 15 KB https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main ------------------------------------------------------------ Total: 24.3 MB The following NEW packages will be INSTALLED: ca-certificates anaconda/pkgs/main/win-64::ca-certificates-2025.9.9-haa95532_0 certifi anaconda/pkgs/main/win-64::certifi-2022.12.7-py37haa95532_0 openssl anaconda/pkgs/main/win-64::openssl-1.1.1w-h2bbff1b_0 pip anaconda/pkgs/main/win-64::pip-22.3.1-py37haa95532_0 python anaconda/pkgs/main/win-64::python-3.7.4-h5263a28_0 setuptools anaconda/pkgs/main/win-64::setuptools-65.6.3-py37haa95532_0 sqlite anaconda/pkgs/main/win-64::sqlite-3.50.2-hda9a48d_1 ucrt anaconda/pkgs/main/win-64::ucrt-10.0.22621.0-haa95532_0 vc anaconda/pkgs/main/win-64::vc-14.3-h2df5915_10 vc14_runtime anaconda/pkgs/main/win-64::vc14_runtime-14.44.35208-h4927774_10 vs2015_runtime anaconda/pkgs/main/win-64::vs2015_runtime-14.44.35208-ha6b5a95_10 wheel anaconda/pkgs/main/win-64::wheel-0.38.4-py37haa95532_0 wincertstore anaconda/pkgs/main/win-64::wincertstore-0.2-py37haa95532_2 Proceed ([y]/n)? Y Downloading and Extracting Packages wheel-0.38.4 | 82 KB | ############################################################################ | 100% openssl-1.1.1w | 5.5 MB | ############################################################################ | 100% wincertstore-0.2 | 15 KB | ############################################################################ | 100% python-3.7.4 | 14.7 MB | ############################################################################ | 100% setuptools-65.6.3 | 1.1 MB | ############################################################################ | 100% certifi-2022.12.7 | 149 KB | ############################################################################ | 100% pip-22.3.1 | 2.7 MB | ############################################################################ | 100% Preparing transaction: done Verifying transaction: done Executing transaction: done # # To activate this environment, use # # $ conda activate tensorflow-cpu # # To deactivate an active environment, use # # $ conda deactivate (base) C:\Users\DELL>conda activate tensorflow Could not find conda environment: tensorflow You can list all discoverable environments with `conda info --envs`. (base) C:\Users\DELL>pip install tensorflow==2.3.0 Looking in indexes: https://mirrors.aliyun.com/pypi/simple/ Collecting tensorflow==2.3.0 Downloading https://mirrors.aliyun.com/pypi/packages/c6/dc/9030097e5774fe02d1be3cb42eb54125d2c0607a6c11172f1dcad2b7fdcc/tensorflow-2.3.0-cp37-cp37m-win_amd64.whl (342.5MB) |████████████████████████████████| 342.5MB 261kB/s Collecting absl-py>=0.7.0 (from tensorflow==2.3.0) Downloading https://mirrors.aliyun.com/pypi/packages/a2/ad/e0d3c824784ff121c03cc031f944bc7e139a8f1870ffd2845cc2dd76f6c4/absl_py-2.1.0-py3-none-any.whl (133kB) |████████████████████████████████| 143kB 364kB/s Collecting google-pasta>=0.1.8 (from tensorflow==2.3.0) Downloading https://mirrors.aliyun.com/pypi/packages/a3/de/c648ef6835192e6e2cc03f40b19eeda4382c49b5bafb43d88b931c4c74ac/google_pasta-0.2.0-py3-none-any.whl (57kB) |████████████████████████████████| 61kB 328kB/s Requirement already satisfied: numpy<1.19.0,>=1.16.0 in e:\anaconda\lib\site-packages (from tensorflow==2.3.0) (1.16.4) Requirement already satisfied: six>=1.12.0 in e:\anaconda\lib\site-packages (from tensorflow==2.3.0) (1.12.0) Requirement already satisfied: keras-preprocessing<1.2,>=1.1.1 in c:\users\dell\appdata\roaming\python\python37\site-packages (from tensorflow==2.3.0) (1.1.2) Collecting termcolor>=1.1.0 (from tensorflow==2.3.0) Downloading https://mirrors.aliyun.com/pypi/packages/67/e1/434566ffce04448192369c1a282931cf4ae593e91907558eaecd2e9f2801/termcolor-2.3.0-py3-none-any.whl Collecting tensorboard<3,>=2.3.0 (from tensorflow==2.3.0) Downloading https://mirrors.aliyun.com/pypi/packages/6f/77/e624b4916531721e674aa105151ffa5223fb224d3ca4bd5c10574664f944/tensorboard-2.11.2-py3-none-any.whl (6.0MB) |████████████████████████████████| 6.0MB 327kB/s Collecting opt-einsum>=2.3.2 (from tensorflow==2.3.0) Downloading https://mirrors.aliyun.com/pypi/packages/bc/19/404708a7e54ad2798907210462fd950c3442ea51acc8790f3da48d2bee8b/opt_einsum-3.3.0-py3-none-any.whl (65kB) |████████████████████████████████| 71kB 459kB/s Collecting scipy==1.4.1 (from tensorflow==2.3.0) Downloading https://mirrors.aliyun.com/pypi/packages/61/51/046cbc61c7607e5ecead6ff1a9453fba5e7e47a5ea8d608cc7036586a5ef/scipy-1.4.1-cp37-cp37m-win_amd64.whl (30.9MB) |████████████████████████████████| 30.9MB 285kB/s Collecting grpcio>=1.8.6 (from tensorflow==2.3.0) Downloading https://mirrors.aliyun.com/pypi/packages/df/8e/2a3c0ba06044e030b7057df9d2e4901f78354fa1e1fc95fb97f7855c3040/grpcio-1.62.3-cp37-cp37m-win_amd64.whl (4.5MB) |████████████████████████████████| 4.5MB 328kB/s Collecting protobuf>=3.9.2 (from tensorflow==2.3.0) Downloading https://mirrors.aliyun.com/pypi/packages/61/70/ee9585603255156d88f07528a6094733e37f8e3f72711b8583fcbb77d5ec/protobuf-4.24.4-cp37-cp37m-win_amd64.whl (430kB) |████████████████████████████████| 430kB 327kB/s Collecting gast==0.3.3 (from tensorflow==2.3.0) Downloading https://mirrors.aliyun.com/pypi/packages/d6/84/759f5dd23fec8ba71952d97bcc7e2c9d7d63bdc582421f3cd4be845f0c98/gast-0.3.3-py2.py3-none-any.whl Collecting h5py<2.11.0,>=2.10.0 (from tensorflow==2.3.0) Downloading https://mirrors.aliyun.com/pypi/packages/a1/6b/7f62017e3f0b32438dd90bdc1ff0b7b1448b6cb04a1ed84f37b6de95cd7b/h5py-2.10.0-cp37-cp37m-win_amd64.whl (2.5MB) |████████████████████████████████| 2.5MB 364kB/s Requirement already satisfied: wheel>=0.26 in e:\anaconda\lib\site-packages (from tensorflow==2.3.0) (0.33.4) Collecting tensorflow-estimator<2.4.0,>=2.3.0 (from tensorflow==2.3.0) Downloading https://mirrors.aliyun.com/pypi/packages/e9/ed/5853ec0ae380cba4588eab1524e18ece1583b65f7ae0e97321f5ff9dfd60/tensorflow_estimator-2.3.0-py2.py3-none-any.whl (459kB) |████████████████████████████████| 460kB 364kB/s Requirement already satisfied: wrapt>=1.11.1 in e:\anaconda\lib\site-packages (from tensorflow==2.3.0) (1.11.2) Collecting astunparse==1.6.3 (from tensorflow==2.3.0) Downloading https://mirrors.aliyun.com/pypi/packages/2b/03/13dde6512ad7b4557eb792fbcf0c653af6076b81e5941d36ec61f7ce6028/astunparse-1.6.3-py2.py3-none-any.whl Collecting google-auth<3,>=1.6.3 (from tensorboard<3,>=2.3.0->tensorflow==2.3.0) Downloading https://mirrors.aliyun.com/pypi/packages/87/24/ec82aee6ba1a076288818fe5cc5125f4d93fffdc68bb7b381c68286c8aaa/google_auth-2.42.0-py2.py3-none-any.whl (222kB) |████████████████████████████████| 225kB 344kB/s Collecting tensorboard-plugin-wit>=1.6.0 (from tensorboard<3,>=2.3.0->tensorflow==2.3.0) Downloading https://mirrors.aliyun.com/pypi/packages/e0/68/e8ecfac5dd594b676c23a7f07ea34c197d7d69b3313afdf8ac1b0a9905a2/tensorboard_plugin_wit-1.8.1-py3-none-any.whl (781kB) |████████████████████████████████| 788kB 297kB/s Requirement already satisfied: requests<3,>=2.21.0 in e:\anaconda\lib\site-packages (from tensorboard<3,>=2.3.0->tensorflow==2.3.0) (2.22.0) Requirement already satisfied: setuptools>=41.0.0 in e:\anaconda\lib\site-packages (from tensorboard<3,>=2.3.0->tensorflow==2.3.0) (41.0.1) Collecting markdown>=2.6.8 (from tensorboard<3,>=2.3.0->tensorflow==2.3.0) Downloading https://mirrors.aliyun.com/pypi/packages/1a/b5/228c1cdcfe138f1a8e01ab1b54284c8b83735476cb22b6ba251656ed13ad/Markdown-3.4.4-py3-none-any.whl (94kB) |████████████████████████████████| 102kB 467kB/s Collecting werkzeug>=1.0.1 (from tensorboard<3,>=2.3.0->tensorflow==2.3.0) Downloading https://mirrors.aliyun.com/pypi/packages/f6/f8/9da63c1617ae2a1dec2fbf6412f3a0cfe9d4ce029eccbda6e1e4258ca45f/Werkzeug-2.2.3-py3-none-any.whl (233kB) |████████████████████████████████| 235kB 344kB/s Collecting google-auth-oauthlib<0.5,>=0.4.1 (from tensorboard<3,>=2.3.0->tensorflow==2.3.0) Downloading https://mirrors.aliyun.com/pypi/packages/b1/0e/0636cc1448a7abc444fb1b3a63655e294e0d2d49092dc3de05241be6d43c/google_auth_oauthlib-0.4.6-py2.py3-none-any.whl Collecting tensorboard-data-server<0.7.0,>=0.6.0 (from tensorboard<3,>=2.3.0->tensorflow==2.3.0) Downloading https://mirrors.aliyun.com/pypi/packages/74/69/5747a957f95e2e1d252ca41476ae40ce79d70d38151d2e494feb7722860c/tensorboard_data_server-0.6.1-py3-none-any.whl Collecting rsa<5,>=3.1.4 (from google-auth<3,>=1.6.3->tensorboard<3,>=2.3.0->tensorflow==2.3.0) Downloading https://mirrors.aliyun.com/pypi/packages/64/8d/0133e4eb4beed9e425d9a98ed6e081a55d195481b7632472be1af08d2f6b/rsa-4.9.1-py3-none-any.whl Collecting pyasn1-modules>=0.2.1 (from google-auth<3,>=1.6.3->tensorboard<3,>=2.3.0->tensorflow==2.3.0) Downloading https://mirrors.aliyun.com/pypi/packages/cd/8e/bea464350e1b8c6ed0da3a312659cb648804a08af6cacc6435867f74f8bd/pyasn1_modules-0.3.0-py2.py3-none-any.whl (181kB) |████████████████████████████████| 184kB 261kB/s Collecting cachetools<7.0,>=2.0.0 (from google-auth<3,>=1.6.3->tensorboard<3,>=2.3.0->tensorflow==2.3.0) Downloading https://mirrors.aliyun.com/pypi/packages/72/76/20fa66124dbe6be5cafeb312ece67de6b61dd91a0247d1ea13db4ebb33c2/cachetools-5.5.2-py3-none-any.whl Requirement already satisfied: idna<2.9,>=2.5 in e:\anaconda\lib\site-packages (from requests<3,>=2.21.0->tensorboard<3,>=2.3.0->tensorflow==2.3.0) (2.8) Requirement already satisfied: chardet<3.1.0,>=3.0.2 in e:\anaconda\lib\site-packages (from requests<3,>=2.21.0->tensorboard<3,>=2.3.0->tensorflow==2.3.0) (3.0.4) Requirement already satisfied: certifi>=2017.4.17 in e:\anaconda\lib\site-packages (from requests<3,>=2.21.0->tensorboard<3,>=2.3.0->tensorflow==2.3.0) (2019.6.16) Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in e:\anaconda\lib\site-packages (from requests<3,>=2.21.0->tensorboard<3,>=2.3.0->tensorflow==2.3.0) (1.24.2) Collecting importlib-metadata>=4.4; python_version < "3.10" (from markdown>=2.6.8->tensorboard<3,>=2.3.0->tensorflow==2.3.0) Downloading https://mirrors.aliyun.com/pypi/packages/ff/94/64287b38c7de4c90683630338cf28f129decbba0a44f0c6db35a873c73c4/importlib_metadata-6.7.0-py3-none-any.whl Collecting MarkupSafe>=2.1.1 (from werkzeug>=1.0.1->tensorboard<3,>=2.3.0->tensorflow==2.3.0) Downloading https://mirrors.aliyun.com/pypi/packages/6c/4c/3577a52eea1880538c435176bc85e5b3379b7ab442327ccd82118550758f/MarkupSafe-2.1.5-cp37-cp37m-win_amd64.whl Collecting requests-oauthlib>=0.7.0 (from google-auth-oauthlib<0.5,>=0.4.1->tensorboard<3,>=2.3.0->tensorflow==2.3.0) Downloading https://mirrors.aliyun.com/pypi/packages/3b/5d/63d4ae3b9daea098d5d6f5da83984853c1bbacd5dc826764b249fe119d24/requests_oauthlib-2.0.0-py2.py3-none-any.whl Collecting pyasn1>=0.1.3 (from rsa<5,>=3.1.4->google-auth<3,>=1.6.3->tensorboard<3,>=2.3.0->tensorflow==2.3.0) Downloading https://mirrors.aliyun.com/pypi/packages/d1/75/4686d2872bf2fc0b37917cbc8bbf0dd3a5cdb0990799be1b9cbf1e1eb733/pyasn1-0.5.1-py2.py3-none-any.whl (84kB) |████████████████████████████████| 92kB 453kB/s Collecting typing-extensions>=3.6.4; python_version < "3.8" (from importlib-metadata>=4.4; python_version < "3.10"->markdown>=2.6.8->tensorboard<3,>=2.3.0->tensorflow==2.3.0) Downloading https://mirrors.aliyun.com/pypi/packages/ec/6b/63cc3df74987c36fe26157ee12e09e8f9db4de771e0f3404263117e75b95/typing_extensions-4.7.1-py3-none-any.whl Requirement already satisfied: zipp>=0.5 in e:\anaconda\lib\site-packages (from importlib-metadata>=4.4; python_version < "3.10"->markdown>=2.6.8->tensorboard<3,>=2.3.0->tensorflow==2.3.0) (0.5.1) Collecting oauthlib>=3.0.0 (from requests-oauthlib>=0.7.0->google-auth-oauthlib<0.5,>=0.4.1->tensorboard<3,>=2.3.0->tensorflow==2.3.0) Downloading https://mirrors.aliyun.com/pypi/packages/7e/80/cab10959dc1faead58dc8384a781dfbf93cb4d33d50988f7a69f1b7c9bbe/oauthlib-3.2.2-py3-none-any.whl (151kB) |████████████████████████████████| 153kB 284kB/s ERROR: tensorboard 2.11.2 has requirement protobuf<4,>=3.9.2, but you&#39;ll have protobuf 4.24.4 which is incompatible. Installing collected packages: absl-py, google-pasta, termcolor, pyasn1, rsa, pyasn1-modules, cachetools, google-auth, tensorboard-plugin-wit, typing-extensions, importlib-metadata, markdown, MarkupSafe, werkzeug, protobuf, oauthlib, requests-oauthlib, google-auth-oauthlib, tensorboard-data-server, grpcio, tensorboard, opt-einsum, scipy, gast, h5py, tensorflow-estimator, astunparse, tensorflow Found existing installation: importlib-metadata 0.17 Uninstalling importlib-metadata-0.17: Successfully uninstalled importlib-metadata-0.17 Found existing installation: MarkupSafe 1.1.1 Uninstalling MarkupSafe-1.1.1: Successfully uninstalled MarkupSafe-1.1.1 Found existing installation: Werkzeug 0.15.4 Uninstalling Werkzeug-0.15.4: Successfully uninstalled Werkzeug-0.15.4 Found existing installation: scipy 1.2.1 Uninstalling scipy-1.2.1: Successfully uninstalled scipy-1.2.1 Found existing installation: h5py 2.9.0 Uninstalling h5py-2.9.0: Successfully uninstalled h5py-2.9.0 Successfully installed MarkupSafe-2.1.5 absl-py-2.1.0 astunparse-1.6.3 cachetools-5.5.2 gast-0.3.3 google-auth-2.42.0 google-auth-oauthlib-0.4.6 google-pasta-0.2.0 grpcio-1.62.3 h5py-2.10.0 importlib-metadata-6.7.0 markdown-3.4.4 oauthlib-3.2.2 opt-einsum-3.3.0 protobuf-4.24.4 pyasn1-0.5.1 pyasn1-modules-0.3.0 requests-oauthlib-2.0.0 rsa-4.9.1 scipy-1.4.1 tensorboard-2.11.2 tensorboard-data-server-0.6.1 tensorboard-plugin-wit-1.8.1 tensorflow-2.3.0 tensorflow-estimator-2.3.0 termcolor-2.3.0 typing-extensions-4.7.1 werkzeug-2.2.3 (base) C:\Users\DELL>-pip install protobuf==3.9.2 &#39;-pip&#39; 不是内部或外部命令,也不是可运行的程序 或批处理文件。 (base) C:\Users\DELL>conda activate tensorflow-cpu (tensorflow-cpu) C:\Users\DELL>pip install protobuf==3.9.2 Looking in indexes: https://mirrors.aliyun.com/pypi/simple/ Collecting protobuf==3.9.2 Downloading https://mirrors.aliyun.com/pypi/packages/92/4e/a90c0000a8dee84c3717ccf86eaafd892f342b0aa242d3cb34d62b1b19dd/protobuf-3.9.2-cp37-cp37m-win_amd64.whl (1.0 MB) ---------------------------------------- 1.0/1.0 MB 373.9 kB/s eta 0:00:00 Collecting six>=1.9 Downloading https://mirrors.aliyun.com/pypi/packages/b7/ce/149a00dd41f10bc29e5921b496af8b574d8413afcd5e30dfa0ed46c2cc5e/six-1.17.0-py2.py3-none-any.whl (11 kB) Requirement already satisfied: setuptools in e:\anaconda\envs\tensorflow-cpu\lib\site-packages (from protobuf==3.9.2) (65.6.3) Installing collected packages: six, protobuf ERROR: pip&#39;s dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. keras-preprocessing 1.1.2 requires numpy>=1.9.1, which is not installed. Successfully installed protobuf-3.9.2 six-1.17.0 (tensorflow-cpu) C:\Users\DELL>pip install numpy==1.21.6 Looking in indexes: https://mirrors.aliyun.com/pypi/simple/ Collecting numpy==1.21.6 Downloading https://mirrors.aliyun.com/pypi/packages/97/9f/da37cc4a188a1d5d203d65ab28d6504e17594b5342e0c1dc5610ee6f4535/numpy-1.21.6-cp37-cp37m-win_amd64.whl (14.0 MB) ---------------------------------------- 14.0/14.0 MB 350.8 kB/s eta 0:00:00 Installing collected packages: numpy Successfully installed numpy-1.21.6 (tensorflow-cpu) C:\Users\DELL>
10-30
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值