在Windows上使用pip安装sqlite3

fcg9iug3  于 2023-11-21  发布在  SQLite
关注(0)|答案(1)|浏览(444)

如何在Python中安装sqlite
我尝试了pip install pysqlite3,但它给了我一个错误

your texterror: subprocess-exited-with-error

 × Building wheel for pysqlite3 (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [12 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build\lib.win-amd64-cpython-311
      creating build\lib.win-amd64-cpython-311\pysqlite3
      copying pysqlite3\dbapi2.py -> build\lib.win-amd64-cpython-311\pysqlite3
      copying pysqlite3\__init__.py -> build\lib.win-amd64-cpython-311\pysqlite3
      running build_ext
      Builds a C extension linking against libsqlite3 library
      building 'pysqlite3._sqlite3' extension
      error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
      [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 p
ysqlite3, which is required to install pyproject.toml-based projects

字符串

guz6ccqo

guz6ccqo1#

这是因为SQLite是错误的或没有安装在路径中,如果你使用Windows.你可以检查SQLite是否是通过Python运行一个小程序,试图打开或创建一个SQLite数据库在您的PC上工作.

import sqlite3

try:
    # Attempts to create a connection to an in-memory SQLite database.
    conn = sqlite3.connect(':memory:')
    print("SQLite is running on your system.")
    conn.close()
except sqlite3.Error as e:
    print(f"Error: {e}")
    print("SQLite is not working correctly on your system.")

字符串

相关问题