Mysqlclient==1.4 6

Tôi đã thử một số giải pháp được đăng ở đây nhưng không gặp may. Tuy nhiên, tôi có thể kết nối với mysql bằng lệnh ‘mysql -u root - p’ mà không gặp vấn đề gì sau khi thay đổi đường dẫn bằng cách làm theo giải pháp được cung cấp trong diễn đàn này

(storefront-yT6GZW6h) C:\Users\Pua Hoover\Desktop\storefront>mysql -u root -p
Enter password: *********
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 49
Server version: 8.0.28 MySQL Community Server - GPL

Copyright (c) 2000, 2022, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

Tôi đang sử dụng phiên bản Window 10 Home và python 3. 8. 2 trong pipenv. Thông báo lỗi tôi nhận được như bên dưới

(storefront-yT6GZW6h) C:\Users\Pua Hoover\Desktop\storefront>pipenv install mysqlclient
Installing mysqlclient...
Error:  An error occurred while installing mysqlclient!
Error text: Collecting mysqlclient
  Using cached mysqlclient-2.1.0.tar.gz (87 kB)
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
Building wheels for collected packages: mysqlclient
  Building wheel for mysqlclient (setup.py): started
  Building wheel for mysqlclient (setup.py): finished with status 'error'
  Running setup.py clean for mysqlclient
Failed to build mysqlclient
Installing collected packages: mysqlclient
  Running setup.py install for mysqlclient: started
  Running setup.py install for mysqlclient: finished with status 'error'

  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [31 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build\lib.win32-3.8
      creating build\lib.win32-3.8\MySQLdb
      copying MySQLdb\__init__.py -> build\lib.win32-3.8\MySQLdb
      copying MySQLdb\_exceptions.py -> build\lib.win32-3.8\MySQLdb
      copying MySQLdb\connections.py -> build\lib.win32-3.8\MySQLdb
      copying MySQLdb\converters.py -> build\lib.win32-3.8\MySQLdb
      copying MySQLdb\cursors.py -> build\lib.win32-3.8\MySQLdb
      copying MySQLdb\release.py -> build\lib.win32-3.8\MySQLdb
      copying MySQLdb\times.py -> build\lib.win32-3.8\MySQLdb
      creating build\lib.win32-3.8\MySQLdb\constants
      copying MySQLdb\constants\__init__.py -> build\lib.win32-3.8\MySQLdb\constants
      copying MySQLdb\constants\CLIENT.py -> build\lib.win32-3.8\MySQLdb\constants
      copying MySQLdb\constants\CR.py -> build\lib.win32-3.8\MySQLdb\constants
      copying MySQLdb\constants\ER.py -> build\lib.win32-3.8\MySQLdb\constants
      copying MySQLdb\constants\FIELD_TYPE.py -> build\lib.win32-3.8\MySQLdb\constants
      copying MySQLdb\constants\FLAG.py -> build\lib.win32-3.8\MySQLdb\constants
      warning: build_py: byte-compiling is disabled, skipping.

      running build_ext
      building 'MySQLdb._mysql' extension
      creating build\temp.win32-3.8
      creating build\temp.win32-3.8\Release
      creating build\temp.win32-3.8\Release\MySQLdb
      "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428\bin\HostX86\x86\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -Dversion_info=(2,1,0,'final',0) -D__version__=2.1.0 "-IC:\Program Files (x86)\MariaDB\MariaDB Connector C\include\mariadb" "-IC:\Program Files (x86)\MariaDB\MariaDB Connector C\include" "-IC:\Users\Pua Hoover\.virtualenvs\storefront-yT6GZW6h\include" "-Ic:\users\pua hoover\appdata\local\programs\python\python38-32\include" "-Ic:\users\pua hoover\appdata\local\programs\python\python38-32\Include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\cppwinrt" /TcMySQLdb/_mysql.c /Fobuild\temp.win32-3.8\Release\MySQLdb/_mysql.obj
      _mysql.c
      MySQLdb/_mysql.c(29): fatal error C1083: Cannot open include file: 'mysql.h': No such file or directory
      error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.14.26428\\bin\\HostX86\\x86\\cl.exe' failed with exit code 2
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for mysqlclient
  error: subprocess-exited-with-error

  × Running setup.py install for mysqlclient did not run successfully.
  │ exit code: 1
  ╰─> [33 lines of output]
      running install
      C:\Users\Pua Hoover\.virtualenvs\storefront-yT6GZW6h\lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      running build
      running build_py
      creating build
      creating build\lib.win32-3.8
      creating build\lib.win32-3.8\MySQLdb
      copying MySQLdb\__init__.py -> build\lib.win32-3.8\MySQLdb
      copying MySQLdb\_exceptions.py -> build\lib.win32-3.8\MySQLdb
      copying MySQLdb\connections.py -> build\lib.win32-3.8\MySQLdb
      copying MySQLdb\converters.py -> build\lib.win32-3.8\MySQLdb
      copying MySQLdb\cursors.py -> build\lib.win32-3.8\MySQLdb
      copying MySQLdb\release.py -> build\lib.win32-3.8\MySQLdb
      copying MySQLdb\times.py -> build\lib.win32-3.8\MySQLdb
      creating build\lib.win32-3.8\MySQLdb\constants
      copying MySQLdb\constants\__init__.py -> build\lib.win32-3.8\MySQLdb\constants
      copying MySQLdb\constants\CLIENT.py -> build\lib.win32-3.8\MySQLdb\constants
      copying MySQLdb\constants\CR.py -> build\lib.win32-3.8\MySQLdb\constants
      copying MySQLdb\constants\ER.py -> build\lib.win32-3.8\MySQLdb\constants
      copying MySQLdb\constants\FIELD_TYPE.py -> build\lib.win32-3.8\MySQLdb\constants
      copying MySQLdb\constants\FLAG.py -> build\lib.win32-3.8\MySQLdb\constants
      warning: build_py: byte-compiling is disabled, skipping.

      running build_ext
      building 'MySQLdb._mysql' extension
      creating build\temp.win32-3.8
      creating build\temp.win32-3.8\Release
      creating build\temp.win32-3.8\Release\MySQLdb
      "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428\bin\HostX86\x86\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -Dversion_info=(2,1,0,'final',0) -D__version__=2.1.0 "-IC:\Program Files (x86)\MariaDB\MariaDB Connector C\include\mariadb" "-IC:\Program Files (x86)\MariaDB\MariaDB Connector C\include" "-IC:\Users\Pua Hoover\.virtualenvs\storefront-yT6GZW6h\include" "-Ic:\users\pua hoover\appdata\local\programs\python\python38-32\include" "-Ic:\users\pua hoover\appdata\local\programs\python\python38-32\Include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\cppwinrt" /TcMySQLdb/_mysql.c /Fobuild\temp.win32-3.8\Release\MySQLdb/_mysql.obj
      _mysql.c
      MySQLdb/_mysql.c(29): fatal error C1083: Cannot open include file: 'mysql.h': No such file or directory
      error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.14.26428\\bin\\HostX86\\x86\\cl.exe' failed with exit code 2
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> mysqlclient

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

Cập nhật. Tôi đã tải xuống bánh xe từ và cài đặt nó. Có vẻ như tôi đã cài đặt thành công mysqlclient

(storefront-yT6GZW6h) C:\Users\Pua Hoover\Desktop\storefront>pipenv install mysqlclient-1.4.6-cp38-cp38-win32.whl
Installing mysqlclient-1.4.6-cp38-cp38-win32.whl...
Adding mysqlclient to Pipfile's [packages]...
Installation Succeeded
Installing dependencies from Pipfile.lock (8c9880)...
  ================================ 1/1 - 00:00:00
(storefront-yT6GZW6h) C:\Users\Pua Hoover\Desktop\storefront>pip show mysqlclient
Name: mysqlclient
Version: 1.4.6
Summary: Python interface to MySQL
Home-page: https://github.com/PyMySQL/mysqlclient-python
Author: Inada Naoki
Author-email: [email protected]
License: GPL
Location: c:\users\pua hoover\.virtualenvs\storefront-yt6gzw6h\lib\site-packages
Requires:
Required-by:

Tuy nhiên, khi tôi thay đổi cơ sở dữ liệu từ sqlite sang mysql trong cài đặt. py và runserver theo hướng dẫn, tôi gặp lỗi bên dưới

Mysqlclient cho Python là gì?

mysqlclient là một nhánh của MySQL-python . Nó bổ sung hỗ trợ Python 3 và sửa nhiều lỗi. MySQLdb là một giao diện cho máy chủ cơ sở dữ liệu MySQL phổ biến dành cho Python. Mục tiêu thiết kế là. Tuân thủ API cơ sở dữ liệu Python phiên bản 2. 0 [PEP-0249]

Làm cách nào để cài đặt máy khách MySQL bằng pip?

Cài đặt ứng dụng MySQL Python trên Mac bằng Homebrew và pip .
Xác minh nếu máy chủ MySQL được cài đặt. .
Nếu bạn chưa cài đặt MySQL, hãy chạy lệnh bên dưới. .
Nếu bạn chưa cài đặt brew, hãy chạy lệnh bên dưới. .
Tạm thời xóa liên kết tượng trưng được tạo trong bước cài đặt MySQL. .
Bây giờ hãy cài đặt trình kết nối MySQL

Mysqlclient có hỗ trợ Python 3 không?

Dự án này là một nhánh của MySQLdb1. Dự án này bổ sung hỗ trợ Python 3 và sửa nhiều lỗi.

Làm cách nào để sử dụng máy khách MySQL trong Python?

Nhập lệnh cho gói bạn muốn cài đặt. .
Để cài đặt gói mysqlclient, gõ lệnh sau. Sao chép pip cài đặt mysqlclient
Để cài đặt gói mysql-connector-python, gõ lệnh sau. Sao chép pip cài đặt mysql-connector-python
Để cài đặt gói pymysql, gõ lệnh sau