Tại sao mysqlclient không cài đặt?

tôi đang sử dụng python3. 8 và django 1. 11. 22

PSC. \WINDOWS\system32> pip cài đặt mysqlclient

Cài đặt các gói đã thu thập. mysqlclient

thiết lập chạy. cài đặt py cho mysqlclient. lỗi

LỖI. Lệnh bị lỗi với trạng thái thoát 1. 'c. \users\admin\appdata\local\programs\python\python38-32\python. exe' -u -c 'nhập sys, setuptools, tokenize; . argv[0] = '"'"'C. \\Users\\Admin\\AppData\\Local\\Temp\\pip-install-olk1oy74\\mysqlclient\\setup. py'"'"'; . \\Users\\Admin\\AppData\\Local\\Temp\\pip-install-olk1oy74\\mysqlclient\\setup. py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f. đọc(). replace('"'"'\r\n'"'"', '"'"'\n'"'"');f. close();exec(biên dịch(code, __file__, '"'"'exec'"'"'))' cài đặt --record 'C. \Users\Admin\AppData\Local\Temp\pip-record-gq4a004x\install-record. txt' --single-version-externally-managed --compile Kiểm tra nhật ký để biết đầu ra lệnh đầy đủ

Tôi đang cố gắng thiết lập ứng dụng Python bằng giao diện cPanel. Tôi đã tạo thành công và thêm các yêu cầu. tập tin txt

Nhưng khi tôi nhấp vào nút "Chạy cài đặt Pip" và chọn "yêu cầu. txt", sau khi nó quay một lúc, tôi nhận được thông báo lỗi này

lỗi. sub process-exit-with-error
× thiết lập trăn. py bdist_wheel không chạy thành công
│ mã thoát. 1
╰─> Xem ở trên để biết đầu ra

Ghi chú. Lỗi này bắt nguồn từ một quy trình con và có thể không phải là sự cố với pip
LỖI. Bánh xe xây dựng không thành công cho mysqlclient
lỗi. sub process-exit-with-error

× Thiết lập chạy. cài đặt py cho mysqlclient không chạy thành công
│ mã thoát. 1
╰─> Xem ở trên để biết đầu ra

Ghi chú. Lỗi này bắt nguồn từ một quy trình con và có thể không phải là sự cố với pip
lỗi. di sản-cài đặt-thất bại

× Đã gặp lỗi khi cài đặt gói
╰─> mysqlclientnote. Đây là sự cố với gói được đề cập ở trên, không phải pip
gợi ý. Xem ở trên để biết đầu ra từ lỗi

Bấm để mở rộng

Các yêu cầu. danh sách tệp txt

Mã số

mysqlclient==2.1.0

và ứng dụng Python của tôi được thiết lập để sử dụng python 3. 8. 6

Làm thế nào tôi có thể hoàn thành việc cài đặt?

 

chào bạn. cPanel không chính thức cung cấp hỗ trợ cho các công cụ Python như được nêu trong thông báo của chúng tôi ở đầu trang tài liệu này

Cách cài đặt ứng dụng Python WSGI. Tài liệu cPanel & WHM

Tài liệu này mô tả cách cài đặt ứng dụng web Python WSGI trên dòng lệnh

Tại sao mysqlclient không cài đặt?
tài liệu. cpanel. net


nhưng bạn đã thử đảm bảo gói mysql-community-devel hoặc mysql-devel đã được cài đặt chưa?

Đây có vẻ là một lỗi tương đối gần đây vì hầu hết thông tin tôi tìm thấy về vấn đề này đã được tạo trong vòng 6 tháng qua. Đây là một ví dụ

Tại sao mysqlclient không cài đặt?

Cách khắc phục Lỗi xây dựng bánh xe cho lỗi MySQL Python

Tìm hiểu cách giải quyết Failed build wheel cho lỗi MySQL Python

sebhastian. com

 

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

Không thể cài đặt mysqlclient?

Trước tiên, hãy kiểm tra xem bạn đã kết nối với Internet chưa và kết nối có ổn định không . Hãy thử chạy lại lệnh. Tiếp theo, bạn sẽ phải tải xuống và cài đặt gói thủ công nếu sự cố vẫn tiếp diễn. Để làm điều này, bạn có thể Google tệp nhị phân của mysqlclient tương thích với thiết bị của bạn hoặc bạn có thể truy cập trang web này.

Làm cách nào để cài đặt ứng dụng 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

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

Sau đây là một số cách. .
Cài đặt MySQL Connector Python bằng lệnh pip
Cài đặt MySQL connector python qua mã nguồn (thông qua tệp ZIP hoặc TAR)
Sử dụng phân phối được xây dựng Một gói được tạo ở định dạng đóng gói gốc dành cho một nền tảng nhất định. Ví dụ các gói RPM cho Linux hay bộ cài MSI cho windows

Làm cách nào để cài đặt ứng dụng khách MySQL cho Django?

Chúng tôi sử dụng các bước sau để thiết lập kết nối giữa Django và MySQL. .
Bước 1. Tạo môi trường ảo và thiết lập dự án Django
Bước - 2 Tạo cơ sở dữ liệu mới
Bước 3. Cập nhật cài đặt. py
Bước - 4 Cài đặt gói mysqlclient
Bước - 5 Chạy lệnh di chuyển