Mysqlclient-1.4 6 cp38-cp38-win32 whl

Khi làm việc với django và mysql theo tài liệu chính thức, chúng tôi phải cài đặt mysqlclient nhưng khi thử cài đặt thì nó báo lỗi khủng khiếp này

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\\BuildTools\\VC\\Tools\\MSVC\\14.16.27023\\bin\\HostX86\\x86\\cl.exe' failed with exit status 2

cài đặt Trình kết nối MySQL/Python không hoạt động nên khi tôi tìm kiếm trên web, tôi đã tìm thấy giải pháp tuyệt vời này

https. // stackoverflow. com/câu hỏi/26866147/mysql-python-install-error-cannot-open-include-file-config-win-h

nhưng khi cài đặt bằng bánh xe thì nó báo lỗi

ERROR: mysqlclient-1.4.6-cp38-cp38-win_amd64.whl is not a supported wheel on this platform.

nhưng phiên bản python của tôi so với 3. 8 nó vẫn không hoạt động. Sau đó, khi cuộn xuống phần bình luận, ojas kulkarni đã đưa ra câu trả lời hay nhất

bạn có thể thử cài đặt sai phiên bản bánh xe, cẩn thận chọn phiên bản phù hợp với môi trường của bạn e. phiên bản g python, 32bit/64bit cần giống với phiên bản bit python của bạn không phải hệ thống

mysqlclient-1 ở đâu. 4. 6-cp38-cp38-win32. whl hoạt động với tôi vì khi tôi kiểm tra phiên bản bit python của mình, nó là 32. Sau đây là cách kiểm tra phiên bản bit python của bạn bằng mô-đun sys

is_64bits = sys.maxsize > 2**32

anh chàng viết mã vui vẻ. Cũng vì tôi chưa quen với phương tiện, vui lòng yêu cầu sửa hoặc đề xuất hoặc khen ngợi. ))))

Bạn có ý nghĩa gì "cùng một lỗi"?

Tôi biết nó không giúp được gì nhiều, nhưng nó hiệu quả với tôi

C:\Windows\system32>pip install --only-binary :all: mysqlclient
Collecting mysqlclient
  Using cached https://files.pythonhosted.org/packages/a8/c4/2c4befb6f78f7b05ad4b1ea725a878738c7908285730838c5e6925eabf89/mysqlclient-1.4.6-cp38-cp38-win_amd64.whl
Installing collected packages: mysqlclient
Successfully installed mysqlclient-1.4.6

Tôi đã thử một số giải pháp được đăng ở đây nhưng không gặp phải. 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 thực hiện theo giải pháp được cung cấp trong diễn đàn này

Nội dung chính Hiển thị

(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. số 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.

Update. Tôi đã tải xuống bánh xe từ Gói mở rộng Python cho Windows - Christoph Gohlke 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

Làm cách nào để cài đặt máy khách MySQL cho 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

Làm cách nào để cài đặt máy khách MySQL trong Windows?

Để cài đặt MySQL Shell trên Microsoft Windows bằng Trình cài đặt MSI, hãy làm như sau. Tải xuống gói Windows (x86, 64-bit), Trình cài đặt MSI từ http. // nhà phát triển. mysql. com/tải xuống/vỏ/. Khi được nhắc, nhấn Chạy. Làm theo các bước trong Hướng dẫn cài đặt

Làm cách nào để cài đặt máy khách MySQL Django?

Thiết lập Dự án Django .

Bước 1. Cài đặt máy khách MySQL. Bạn có thể cài đặt máy khách MySQL trực tiếp thông qua pip bằng lệnh. cài đặt pip đặt mysqlclient.