Hướng dẫn running setup py install for mysqlclient error error: command errored out with exit status 1 - đang chạy thiết lập cài đặt py cho lỗi lỗi mysqlclient: lệnh bị lỗi với trạng thái thoát 1

Tôi đang cố gắng sử dụng Django và sử dụng MySQL làm cơ sở dữ liệu. Ban đầu tôi đã hoạt động tốt nhưng gần đây tôi đã thay đổi tên của tài khoản người dùng và đó là nơi mọi thứ đã sai. Tôi đã sử dụng pip cài đặt mysqlclient nhưng lỗi dưới đây là những gì tôi nhận được. Có cách nào để cài đặt mysqlclient một cách khác không?

Tôi đang sử dụng phiên bản mới nhất của Django và tôi đang sử dụng mã trực quan. Cảm ơn bạn

    ERROR: Command errored out with exit status 1:
     command: 'c:\users\jacob\appdata\local\programs\python\python37-32\python.e
xe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\JACOB
\\AppData\\Local\\Temp\\pip-install-ehb3yr50\\mysqlclient\\setup.py'"'"'; __file
__='"'"'C:\\Users\\JACOB\\AppData\\Local\\Temp\\pip-install-ehb3yr50\\mysqlclien
t\\setup.py'"'"';f=getattr[tokenize, '"'"'open'"'"', open][__file__];code=f.read
[].replace['"'"'\r\n'"'"', '"'"'\n'"'"'];f.close[];exec[compile[code, __file__,
'"'"'exec'"'"']]' install --record 'C:\Users\JACOB\AppData\Local\Temp\pip-record
-hbel0tdu\install-record.txt' --single-version-externally-managed --compile
         cwd: C:\Users\JACOB\AppData\Local\Temp\pip-install-ehb3yr50\mysqlclient
\
    Complete output [30 lines]:
    running install
    running build
    running build_py
    creating build
    creating build\lib.win32-3.7
    creating build\lib.win32-3.7\MySQLdb
    copying MySQLdb\__init__.py -> build\lib.win32-3.7\MySQLdb
    copying MySQLdb\_exceptions.py -> build\lib.win32-3.7\MySQLdb
    copying MySQLdb\compat.py -> build\lib.win32-3.7\MySQLdb
    copying MySQLdb\connections.py -> build\lib.win32-3.7\MySQLdb
    copying MySQLdb\converters.py -> build\lib.win32-3.7\MySQLdb
    copying MySQLdb\cursors.py -> build\lib.win32-3.7\MySQLdb
    copying MySQLdb\release.py -> build\lib.win32-3.7\MySQLdb
    copying MySQLdb\times.py -> build\lib.win32-3.7\MySQLdb
    creating build\lib.win32-3.7\MySQLdb\constants
    copying MySQLdb\constants\__init__.py -> build\lib.win32-3.7\MySQLdb\constan
ts
    copying MySQLdb\constants\CLIENT.py -> build\lib.win32-3.7\MySQLdb\constants

    copying MySQLdb\constants\CR.py -> build\lib.win32-3.7\MySQLdb\constants
    copying MySQLdb\constants\ER.py -> build\lib.win32-3.7\MySQLdb\constants
    copying MySQLdb\constants\FIELD_TYPE.py -> build\lib.win32-3.7\MySQLdb\const
ants
    copying MySQLdb\constants\FLAG.py -> build\lib.win32-3.7\MySQLdb\constants
    running build_ext
    building 'MySQLdb._mysql' extension
    creating build\temp.win32-3.7
    creating build\temp.win32-3.7\Release
    creating build\temp.win32-3.7\Release\MySQLdb
    C:\Program Files [x86]\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\
14.22.27905\bin\HostX86\x86\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MT -Dversion
_info=[1,4,4,'final',0] -D__version__=1.4.4 "-IC:\Program Files [x86]\MySQL\MySQ
L Connector C 6.1\include\mariadb" -Ic:\users\jacob\appdata\local\programs\pytho
n\python37-32\include -Ic:\users\jacob\appdata\local\programs\python\python37-32
\include "-IC:\Program Files [x86]\Microsoft Visual Studio\2019\Community\VC\Too
ls\MSVC\14.22.27905\ATLMFC\include" "-IC:\Program Files [x86]\Microsoft Visual S
tudio\2019\Community\VC\Tools\MSVC\14.22.27905\include" "-IC:\Program Files [x86
]\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files [x86]\Windows Kits
\10\include\10.0.18362.0\ucrt" "-IC:\Program Files [x86]\Windows Kits\10\include
\10.0.18362.0\shared" "-IC:\Program Files [x86]\Windows Kits\10\include\10.0.183
62.0\um" "-IC:\Program Files [x86]\Windows Kits\10\include\10.0.18362.0\winrt" "
-IC:\Program Files [x86]\Windows Kits\10\include\10.0.18362.0\cppwinrt" /TcMySQL
db/_mysql.c /Fobuild\temp.win32-3.7\Release\MySQLdb/_mysql.obj /Zl /D_CRT_SECURE
_NO_WARNINGS
    _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\\2019\\Comm
unity\\VC\\Tools\\MSVC\\14.22.27905\\bin\\HostX86\\x86\\cl.exe' failed with exit
 status 2
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\jacob\appdata\local\pro
grams\python\python37-32\python.exe' -u -c 'import sys, setuptools, tokenize; sy
s.argv[0] = '"'"'C:\\Users\\JACOB\\AppData\\Local\\Temp\\pip-install-ehb3yr50\\m
ysqlclient\\setup.py'"'"'; __file__='"'"'C:\\Users\\JACOB\\AppData\\Local\\Temp\
\pip-install-ehb3yr50\\mysqlclient\\setup.py'"'"';f=getattr[tokenize, '"'"'open'
"'"', open][__file__];code=f.read[].replace['"'"'\r\n'"'"', '"'"'\n'"'"'];f.clos
e[];exec[compile[code, __file__, '"'"'exec'"'"']]' install --record 'C:\Users\JA
COB\AppData\Local\Temp\pip-record-hbel0tdu\install-record.txt' --single-version-
externally-managed --compile Check the logs for full command output.

Lỗi: Lệnh bị lỗi với trạng thái thoát 1 mysqlclient: Tôi đã cài đặt mysqlclient cho dự án django mới của tôi trong Ubuntu Linux mới được cài đặt của tôi. Và sau khi thực hiện cài đặt pip mysqlclient, tôi đã gặp lỗi của ERROR: Command errored out with exit status 1:: I was installing mysqlclient for my new Django project in my newly installed Ubuntu Linux. And after doing pip install mysqlclient, I got an error of ERROR: Command errored out with exit status 1:

[env] [email protected]:~/Projects/aeck$ pip3 install mysqlclient
Collecting mysqlclient
  Using cached mysqlclient-2.0.3.tar.gz [88 kB]
    ERROR: Command errored out with exit status 1:
     command: /home/codie/Projects/aeck/env/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-4_d_xjb9/mysqlclient/setup.py'"'"'; __file__='"'"'/tmp/pip-install-4_d_xjb9/mysqlclient/setup.py'"'"';f=getattr[tokenize, '"'"'open'"'"', open][__file__];code=f.read[].replace['"'"'\r\n'"'"', '"'"'\n'"'"'];f.close[];exec[compile[code, __file__, '"'"'exec'"'"']]' egg_info --egg-base /tmp/pip-install-4_d_xjb9/mysqlclient/pip-egg-info
         cwd: /tmp/pip-install-4_d_xjb9/mysqlclient/
    Complete output [15 lines]:
    /bin/sh: 1: mysql_config: not found
    /bin/sh: 1: mariadb_config: not found
    /bin/sh: 1: mysql_config: not found
    Traceback [most recent call last]:
      File "", line 1, in 
      File "/tmp/pip-install-4_d_xjb9/mysqlclient/setup.py", line 15, in 
        metadata, options = get_config[]
      File "/tmp/pip-install-4_d_xjb9/mysqlclient/setup_posix.py", line 70, in get_config
        libs = mysql_config["libs"]
      File "/tmp/pip-install-4_d_xjb9/mysqlclient/setup_posix.py", line 31, in mysql_config
        raise OSError["{} not found".format[_mysql_config_path]]
    OSError: mysql_config not found
    mysql_config --version
    mariadb_config --version
    mysql_config --libs
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Ngoài ra, giải quyết vấn đề của bạn cho lỗi psycopg2 cài đặt ubuntu

Vì vậy, làm thế nào chúng ta có thể khắc phục vấn đề của /bin /sh: 1: mysql_config: không tìm thấy hoặc /bin /sh: 1: mariadb_config: không tìm thấy./bin/sh: 1: mysql_config: not found or /bin/sh: 1: mariadb_config: not found.

Tôi đã thực hiện một số nghiên cứu và sau khi đào web trong 15 phút, tôi đã sửa chữa cho vấn đề này.

Để khắc phục sự cố Lỗi cài đặt PIP MySQLClient, bạn chỉ cần sao chép các mã bên dưới và thực hiện chúng trong vỏ Bash của bạn.pip install mysqlclient error, you just need to copy the below codes and execute them in your bash-shell.

Cài đặt gói Python3-Dev

________ 8 & nbsp; chứa & nbsp; các tệp tiêu đề & nbsp; mà hệ thống cần & nbsp; để xây dựng & nbsp; các phần mở rộng python. Nó được sử dụng bởi & nbsp; ________ 9 & nbsp; vì nó bao gồm các phần mở rộng Python C cho hiệu suất cao.to build Python extensions. It is used by lxml because it includes Python C extensions for high performance.

sudo apt-get install python3-dev

________ 9 & nbsp; là tiện ích mở rộng & nbsp; python c-api & nbsp; được biên dịch khi chúng tôi chạy lệnh & nbsp; ________ 11.Python C-API extension that is compiled when we run the command 

[env] [email protected]:~/Projects/aeck$ pip3 install mysqlclient
Collecting mysqlclient
  Using cached mysqlclient-2.0.3.tar.gz [88 kB]
    ERROR: Command errored out with exit status 1:
     command: /home/codie/Projects/aeck/env/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-4_d_xjb9/mysqlclient/setup.py'"'"'; __file__='"'"'/tmp/pip-install-4_d_xjb9/mysqlclient/setup.py'"'"';f=getattr[tokenize, '"'"'open'"'"', open][__file__];code=f.read[].replace['"'"'\r\n'"'"', '"'"'\n'"'"'];f.close[];exec[compile[code, __file__, '"'"'exec'"'"']]' egg_info --egg-base /tmp/pip-install-4_d_xjb9/mysqlclient/pip-egg-info
         cwd: /tmp/pip-install-4_d_xjb9/mysqlclient/
    Complete output [15 lines]:
    /bin/sh: 1: mysql_config: not found
    /bin/sh: 1: mariadb_config: not found
    /bin/sh: 1: mysql_config: not found
    Traceback [most recent call last]:
      File "", line 1, in 
      File "/tmp/pip-install-4_d_xjb9/mysqlclient/setup.py", line 15, in 
        metadata, options = get_config[]
      File "/tmp/pip-install-4_d_xjb9/mysqlclient/setup_posix.py", line 70, in get_config
        libs = mysql_config["libs"]
      File "/tmp/pip-install-4_d_xjb9/mysqlclient/setup_posix.py", line 31, in mysql_config
        raise OSError["{} not found".format[_mysql_config_path]]
    OSError: mysql_config not found
    mysql_config --version
    mariadb_config --version
    mysql_config --libs
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
1.

Các nguồn LXML có ít nhất một cái gì đó như & nbsp; ________ 12 & nbsp; trong mã. Trình biên dịch tìm kiếm & nbsp; tệp tiêu đề & nbsp; ________ 13 & nbsp; trong quá trình biên dịch, do đó các tệp & nbsp; các tệp tiêu đề & nbsp; cần phải có trên hệ thống của bạn để chúng có thể được tìm thấy.

Ngoài ra, giải quyết: thất bại biên dịch pip mysqlclient trên Linux trên Linux

[env] [email protected]:~/Projects/aeck$ sudo apt-get install libmysqlclient-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  libssl-dev libssl1.1
Suggested packages:
  libssl-doc
The following NEW packages will be installed:
  libmysqlclient-dev libssl-dev
The following packages will be upgraded:
  libssl1.1
1 upgraded, 2 newly installed, 0 to remove and 107 not upgraded.
Need to get 4,437 kB of archives.
After this operation, 17.8 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 //us.archive.ubuntu.com/ubuntu focal-updates/main amd64 libssl1.1 amd64 1.1.1f-1ubuntu2.3 [1,320 kB]
Get:2 //us.archive.ubuntu.com/ubuntu focal-updates/main amd64 libssl-dev amd64 1.1.1f-1ubuntu2.3 [1,582 kB]
Get:3 //us.archive.ubuntu.com/ubuntu focal-updates/main amd64 libmysqlclient-dev amd64 8.0.23-0ubuntu0.20.04.1 [1,536 kB]
Fetched 4,437 kB in 5s [921 kB/s]               
Preconfiguring packages ...
[Reading database ... 132596 files and directories currently installed.]
Preparing to unpack .../libssl1.1_1.1.1f-1ubuntu2.3_amd64.deb ...
Unpacking libssl1.1:amd64 [1.1.1f-1ubuntu2.3] over [1.1.1f-1ubuntu2.1] ...
Selecting previously unselected package libssl-dev:amd64.
Preparing to unpack .../libssl-dev_1.1.1f-1ubuntu2.3_amd64.deb ...
Unpacking libssl-dev:amd64 [1.1.1f-1ubuntu2.3] ...
Selecting previously unselected package libmysqlclient-dev.
Preparing to unpack .../libmysqlclient-dev_8.0.23-0ubuntu0.20.04.1_amd64.deb ...
Unpacking libmysqlclient-dev [8.0.23-0ubuntu0.20.04.1] ...
Setting up libssl1.1:amd64 [1.1.1f-1ubuntu2.3] ...
Setting up libssl-dev:amd64 [1.1.1f-1ubuntu2.3] ...
Setting up libmysqlclient-dev [8.0.23-0ubuntu0.20.04.1] ...
Processing triggers for man-db [2.9.1-1] ...
Processing triggers for libc-bin [2.31-0ubuntu9.2] ...

Cài đặt phụ thuộc cho mysqlclient

Bây giờ, bạn chỉ cần cài đặt sự phụ thuộc cho mysqlclient được gọi là

[env] [email protected]:~/Projects/aeck$ pip3 install mysqlclient
Collecting mysqlclient
  Using cached mysqlclient-2.0.3.tar.gz [88 kB]
    ERROR: Command errored out with exit status 1:
     command: /home/codie/Projects/aeck/env/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-4_d_xjb9/mysqlclient/setup.py'"'"'; __file__='"'"'/tmp/pip-install-4_d_xjb9/mysqlclient/setup.py'"'"';f=getattr[tokenize, '"'"'open'"'"', open][__file__];code=f.read[].replace['"'"'\r\n'"'"', '"'"'\n'"'"'];f.close[];exec[compile[code, __file__, '"'"'exec'"'"']]' egg_info --egg-base /tmp/pip-install-4_d_xjb9/mysqlclient/pip-egg-info
         cwd: /tmp/pip-install-4_d_xjb9/mysqlclient/
    Complete output [15 lines]:
    /bin/sh: 1: mysql_config: not found
    /bin/sh: 1: mariadb_config: not found
    /bin/sh: 1: mysql_config: not found
    Traceback [most recent call last]:
      File "", line 1, in 
      File "/tmp/pip-install-4_d_xjb9/mysqlclient/setup.py", line 15, in 
        metadata, options = get_config[]
      File "/tmp/pip-install-4_d_xjb9/mysqlclient/setup_posix.py", line 70, in get_config
        libs = mysql_config["libs"]
      File "/tmp/pip-install-4_d_xjb9/mysqlclient/setup_posix.py", line 31, in mysql_config
        raise OSError["{} not found".format[_mysql_config_path]]
    OSError: mysql_config not found
    mysql_config --version
    mariadb_config --version
    mysql_config --libs
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
4.

sudo apt-get install libmysqlclient-dev

[env] [email protected]:~/Projects/aeck$ pip3 install mysqlclient
Collecting mysqlclient
  Using cached mysqlclient-2.0.3.tar.gz [88 kB]
    ERROR: Command errored out with exit status 1:
     command: /home/codie/Projects/aeck/env/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-4_d_xjb9/mysqlclient/setup.py'"'"'; __file__='"'"'/tmp/pip-install-4_d_xjb9/mysqlclient/setup.py'"'"';f=getattr[tokenize, '"'"'open'"'"', open][__file__];code=f.read[].replace['"'"'\r\n'"'"', '"'"'\n'"'"'];f.close[];exec[compile[code, __file__, '"'"'exec'"'"']]' egg_info --egg-base /tmp/pip-install-4_d_xjb9/mysqlclient/pip-egg-info
         cwd: /tmp/pip-install-4_d_xjb9/mysqlclient/
    Complete output [15 lines]:
    /bin/sh: 1: mysql_config: not found
    /bin/sh: 1: mariadb_config: not found
    /bin/sh: 1: mysql_config: not found
    Traceback [most recent call last]:
      File "", line 1, in 
      File "/tmp/pip-install-4_d_xjb9/mysqlclient/setup.py", line 15, in 
        metadata, options = get_config[]
      File "/tmp/pip-install-4_d_xjb9/mysqlclient/setup_posix.py", line 70, in get_config
        libs = mysql_config["libs"]
      File "/tmp/pip-install-4_d_xjb9/mysqlclient/setup_posix.py", line 31, in mysql_config
        raise OSError["{} not found".format[_mysql_config_path]]
    OSError: mysql_config not found
    mysql_config --version
    mariadb_config --version
    mysql_config --libs
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
4 là một gói cung cấp tất cả các phụ thuộc và tài nguyên thiết yếu cho hệ thống cần thiết cho hoạt động của mysqlclient.

Cho Python3.9

sudo apt-get install python3.9-dev build-essential

Cuối cùng, PIP cài đặt mysqlclient

Bây giờ, bạn có thể cài đặt mysqlclient mà không căng thẳng.

python3 -m pip install mysqlclient
or
pip3 install mysqlclient

Bài Viết Liên Quan

Chủ Đề