我安装了peewee,但它不支持peewee文件中的pysqlite

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

当我尝试安装它时,出现此错误。

Collecting pysqlite3
  Using cached pysqlite3-0.5.2.tar.gz (40 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: pysqlite3
  Building wheel for pysqlite3 (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Building wheel for pysqlite3 (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [41 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.macosx-10.9-universal2-cpython-312
      creating build/lib.macosx-10.9-universal2-cpython-312/pysqlite3
      copying pysqlite3/__init__.py -> build/lib.macosx-10.9-universal2-cpython-312/pysqlite3
      copying pysqlite3/dbapi2.py -> build/lib.macosx-10.9-universal2-cpython-312/pysqlite3
      running build_ext
      Builds a C extension linking against libsqlite3 library
      building 'pysqlite3._sqlite3' extension
      creating build/temp.macosx-10.9-universal2-cpython-312
      creating build/temp.macosx-10.9-universal2-cpython-312/src
      clang -fno-strict-overflow -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -O3 -Wall -arch arm64 -arch x86_64 -g -Qunused-arguments -DMODULE_NAME=\"pysqlite3.dbapi2\" -I/usr/include -I/Users/pc/Documents/GitHub/OCR/venv/include -I/Library/Frameworks/Python.framework/Versions/3.12/include/python3.12 -c src/blob.c -o build/temp.macosx-10.9-universal2-cpython-312/src/blob.o
      clang -fno-strict-overflow -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -O3 -Wall -arch arm64 -arch x86_64 -g -Qunused-arguments -DMODULE_NAME=\"pysqlite3.dbapi2\" -I/usr/include -I/Users/pc/Documents/GitHub/OCR/venv/include -I/Library/Frameworks/Python.framework/Versions/3.12/include/python3.12 -c src/cache.c -o build/temp.macosx-10.9-universal2-cpython-312/src/cache.o
      clang -fno-strict-overflow -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -O3 -Wall -arch arm64 -arch x86_64 -g -Qunused-arguments -DMODULE_NAME=\"pysqlite3.dbapi2\" -I/usr/include -I/Users/pc/Documents/GitHub/OCR/venv/include -I/Library/Frameworks/Python.framework/Versions/3.12/include/python3.12 -c src/connection.c -o build/temp.macosx-10.9-universal2-cpython-312/src/connection.o
      src/connection.c:1111:10: warning: 'sqlite3_create_window_function' is only available on macOS 10.15 or newer [-Wunguarded-availability-new]
          rc = sqlite3_create_window_function(
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sqlite3.h:5533:16: note: 'sqlite3_create_window_function' has been marked as being introduced in macOS 10.15 here, but the deployment target is macOS 10.9.0
      SQLITE_API int sqlite3_create_window_function(
                     ^
      src/connection.c:1111:10: note: enclose 'sqlite3_create_window_function' in a __builtin_available check to silence this warning
          rc = sqlite3_create_window_function(
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      src/connection.c:1385:10: error: call to undeclared function 'sqlite3_enable_load_extension'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
          rc = sqlite3_enable_load_extension(self->db, onoff);
               ^
      src/connection.c:1385:10: note: did you mean 'pysqlite_enable_load_extension'?
      src/connection.c:1372:18: note: 'pysqlite_enable_load_extension' declared here
      static PyObject* pysqlite_enable_load_extension(pysqlite_Connection* self, PyObject* args)
                       ^
      src/connection.c:1409:10: error: call to undeclared function 'sqlite3_load_extension'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
          rc = sqlite3_load_extension(self->db, extension_name, 0, &errmsg);
               ^
      src/connection.c:1409:10: note: did you mean 'pysqlite_load_extension'?
      src/connection.c:1395:18: note: 'pysqlite_load_extension' declared here
      static PyObject* pysqlite_load_extension(pysqlite_Connection* self, PyObject* args)
                       ^
      1 warning and 2 errors generated.
      error: command '/usr/bin/clang' failed with exit code 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for pysqlite3
Failed to build pysqlite3
ERROR: Could not build wheels for pysqlite3, which is required to install pyproject.toml-based projects

我删除并重新安装了peewee和python,但没有任何改善。

python peewee pysqlite
1个回答
0
投票

这与peewee无关。看起来您正在尝试安装

pysqlite3
(标准库 sqlite3 模块的替代品,并添加了一些内容),并且缺少从源代码编译它所需的 sqlite3 标头。您有三个选择:

  • 什么都不做,只用 peewee 并快乐起来。它与标准库
    sqlite3
    模块配合得很好。
  • 安装 sqlite3 标头,例如
    apt-get install libsqlite3-dev
    基于 Debian。
  • 安装 x86-64 Linux 的预构建二进制文件:
    pip install pysqlite3-binary
    。但是,如果您使用不同的架构,则需要从源代码构建。

pysqlite3 自述文件非常清楚:https://github.com/coleifer/pysqlite3/

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