找回密码
 注册
查看: 35|回复: 2

pip install mysqlclient错误提示

[复制链接]

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
发表于 2024-7-27 21:00:05 | 显示全部楼层 |阅读模式
pip install mysqlclient4 v. N# V+ w# Z0 t4 G2 M' }
Collecting mysqlclient
+ V: Q7 f6 ^* ]4 P( ]/ Q+ X6 g7 u  Using cached mysqlclient-2.2.4.tar.gz (90 kB)
& D: n  g- M8 K  Installing build dependencies ... done$ Z" _3 H1 R# w8 M/ o
  Getting requirements to build wheel ... done
: b2 B2 q! k+ W  Preparing metadata (pyproject.toml) ... done+ Q% b3 _. \- V: @' [0 k
Building wheels for collected packages: mysqlclient# w1 r+ T) n9 y3 `8 `" g
  Building wheel for mysqlclient (pyproject.toml) ... error- ~4 v( N" v( z, C, r
  error: subprocess-exited-with-error3 [' n4 J3 Q& B" F; a
& A" P3 }9 b* m+ i) i' {
  × Building wheel for mysqlclient (pyproject.toml) did not run successfully.! W; R2 Z  E8 d( Q: Y- h5 a! U! i
  │ exit code: 1
. o, O& L9 |, @  ╰─> [63 lines of output]
* d8 `/ C; T4 f$ n1 Q2 g      # Options for building extension module:% n( E& H& }7 N5 W3 N" P# p
        extra_compile_args: ['-I/usr/include/mysql', '-std=c99']
/ s9 X! M3 ]: f$ P1 [, r( P        extra_link_args: ['-L/usr/lib/x86_64-linux-gnu']
; g; U6 V6 ^8 n7 X* N        define_macros: [('version_info', (2, 2, 4, 'final', 0)), ('__version__', '2.2.4')]6 e- w$ B; Y% h0 y, T
      running bdist_wheel
8 ~- {6 K' Y# a/ g- B0 E5 }      running build5 i* o# |3 K' Q' F! K6 i' ~
      running build_py
3 b2 _" r  }/ h  c      creating build' F2 R5 o; |# ~) X( R+ Y! t" s1 T2 X
      creating build/lib.linux-x86_64-cpython-312
4 [5 I- P( }4 K! Z; L3 B      creating build/lib.linux-x86_64-cpython-312/MySQLdb* B% B2 z+ V6 W  E. }( e
      copying src/MySQLdb/__init__.py -> build/lib.linux-x86_64-cpython-312/MySQLdb9 A9 m% I- \2 O( A1 R6 o% C2 {0 P
      copying src/MySQLdb/_exceptions.py -> build/lib.linux-x86_64-cpython-312/MySQLdb4 ^4 y% m6 R7 b* X% F
      copying src/MySQLdb/connections.py -> build/lib.linux-x86_64-cpython-312/MySQLdb! B. R( l, B* |# _' @& N
      copying src/MySQLdb/converters.py -> build/lib.linux-x86_64-cpython-312/MySQLdb. a  v0 R2 q  z1 S
      copying src/MySQLdb/cursors.py -> build/lib.linux-x86_64-cpython-312/MySQLdb
+ o* I" V1 p' m. L, _! C      copying src/MySQLdb/release.py -> build/lib.linux-x86_64-cpython-312/MySQLdb9 h$ @6 O5 B( G8 x* a+ B* S- v6 \9 j! u
      copying src/MySQLdb/times.py -> build/lib.linux-x86_64-cpython-312/MySQLdb
" }4 c4 O- {3 P! {7 a      creating build/lib.linux-x86_64-cpython-312/MySQLdb/constants
1 T3 T. F$ p3 P7 U      copying src/MySQLdb/constants/CLIENT.py -> build/lib.linux-x86_64-cpython-312/MySQLdb/constants
. H% e2 _$ d+ @  i' G      copying src/MySQLdb/constants/CR.py -> build/lib.linux-x86_64-cpython-312/MySQLdb/constants
9 F; ?5 z% n" H' Y- H      copying src/MySQLdb/constants/ER.py -> build/lib.linux-x86_64-cpython-312/MySQLdb/constants7 o& e( j7 ~) |" A& B' ]
      copying src/MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-cpython-312/MySQLdb/constants  C3 \% R8 T# l3 `
      copying src/MySQLdb/constants/FLAG.py -> build/lib.linux-x86_64-cpython-312/MySQLdb/constants- W8 ~: S7 `" l3 B  I1 \
      copying src/MySQLdb/constants/__init__.py -> build/lib.linux-x86_64-cpython-312/MySQLdb/constants
- l; d* c8 M8 k4 M4 m8 ]0 _6 W      running egg_info
+ d$ Y  ?( K# x  ~      writing src/mysqlclient.egg-info/PKG-INFO
8 k4 C4 z0 y0 L7 n0 J2 Z. k      writing dependency_links to src/mysqlclient.egg-info/dependency_links.txt$ A& k" v8 A- ~4 t  y% x- Z1 t
      writing top-level names to src/mysqlclient.egg-info/top_level.txt
. a" A& \" U/ w( [) I% f+ X# y9 |/ C      reading manifest file 'src/mysqlclient.egg-info/SOURCES.txt'. k& U/ X& l7 Z! w5 u3 Q+ r
      reading manifest template 'MANIFEST.in'. R# Z! B0 D- k7 K
      adding license file 'LICENSE'
" r! g( p* P1 {; u0 I      writing manifest file 'src/mysqlclient.egg-info/SOURCES.txt'
" l" ?6 i0 d- w) H# V$ e      copying src/MySQLdb/_mysql.c -> build/lib.linux-x86_64-cpython-312/MySQLdb
9 d' ^% g4 I; w; }$ a+ @      running build_ext) p& ?) A+ d/ `  b* R+ R# g
      building 'MySQLdb._mysql' extension
  O6 S* ^8 P( c6 `' u& @5 C      creating build/temp.linux-x86_64-cpython-312
* H- j! O  L* K. M6 u. `      creating build/temp.linux-x86_64-cpython-312/src
4 L: b8 C0 |( b0 }8 k      creating build/temp.linux-x86_64-cpython-312/src/MySQLdb% f4 a, p& P) @1 V
      gcc -std=gnu11 -pthread -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O3 -Wall -fPIC "-Dversion_info=(2, 2, 4, 'final', 0)" -D__version__=2.2.4 -I/usr/local/python312/include/python3.12 -c src/MySQLdb/_mysql.c -o build/temp.linux-x86_64-cpython-312/src/MySQLdb/_mysql.o -I/usr/include/mysql -std=c995 p; H. A$ G1 ?8 @6 S
      src/MySQLdb/_mysql.c: 在函数‘_mysql_ConnectionObject_Initialize’中:1 N  E3 G& ]! D0 M0 e
      src/MySQLdb/_mysql.c:539:44: 错误:‘MYSQL_OPT_SSL_KEY’未声明(在此函数内第一次使用)
+ f" z( x# I" X* B( A8 a5 X5 a1 G               mysql_options(&(self->connection), MYSQL_OPT_SSL_KEY, key);% v/ m+ ]" m" [) `4 X- b
                                                  ^
+ e% L; p: \: f, ]+ t) G      src/MySQLdb/_mysql.c:539:44: 附注:每个未声明的标识符在其出现的函数内只报告一次
% [/ T/ m0 W) p& A5 o8 p; X      src/MySQLdb/_mysql.c:540:44: 错误:‘MYSQL_OPT_SSL_CERT’未声明(在此函数内第一次使用)3 C& P* F2 ]+ U6 E1 h! }' b6 E
               mysql_options(&(self->connection), MYSQL_OPT_SSL_CERT, cert);; v9 d3 y; Y' K# ^1 [0 Z
                                                  ^
$ W! v7 K8 Y5 o      src/MySQLdb/_mysql.c:541:44: 错误:‘MYSQL_OPT_SSL_CA’未声明(在此函数内第一次使用)6 h: {" z  D. S* m' Y/ h, E4 R& e
               mysql_options(&(self->connection), MYSQL_OPT_SSL_CA, ca);( @( h6 Y# d! `$ F) T9 |
                                                  ^" g" Z) l2 U2 U; }9 X
      src/MySQLdb/_mysql.c:542:44: 错误:‘MYSQL_OPT_SSL_CAPATH’未声明(在此函数内第一次使用)
. N# P% m/ t# x* F/ L  u               mysql_options(&(self->connection), MYSQL_OPT_SSL_CAPATH, capath);
0 ~! O. v9 ~. ^2 Y; W. u                                                  ^
' \/ W4 K! ?3 K, l      src/MySQLdb/_mysql.c:543:44: 错误:‘MYSQL_OPT_SSL_CIPHER’未声明(在此函数内第一次使用)2 q6 G7 n' \4 Y, d! ^! ]& m
               mysql_options(&(self->connection), MYSQL_OPT_SSL_CIPHER, cipher);' a; z) @3 t( J+ N
                                                  ^
( _7 n/ i9 y) K8 k$ X1 d* Q      src/MySQLdb/_mysql.c:556:13: 警告:隐式声明函数‘mysql_optionsv’ [-Wimplicit-function-declaration]( |% f6 w9 ~; G
                   mysql_optionsv(&(self->connection), MYSQL_OPT_SSL_ENFORCE, (void *)&enforce_tls);
' q. N0 ^# H6 y3 I" x* O3 U                   ^
9 Y) K1 q% O' W! X( S; {. H1 W      src/MySQLdb/_mysql.c:556:49: 错误:‘MYSQL_OPT_SSL_ENFORCE’未声明(在此函数内第一次使用)5 E  B- z: r% ?$ ]- I
                   mysql_optionsv(&(self->connection), MYSQL_OPT_SSL_ENFORCE, (void *)&enforce_tls);  v2 T1 O. G& D
                                                       ^
) U, k2 o6 G3 m( M- }& D      error: command '/usr/bin/gcc' failed with exit code 1
2 Q) _* G/ n2 c0 ~- r      [end of output], v1 a. s* P  A/ g2 p, R+ `
4 S1 n% R( f- R- f# h
  note: This error originates from a subprocess, and is likely not a problem with pip.
" d  K' w6 y; K$ `* W  ERROR: Failed building wheel for mysqlclient$ D& Y5 z+ X/ y
Failed to build mysqlclient" ~3 n: G. Z% S
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (mysqlclient); y) g& N, ?% e+ ~/ W4 l. \
! Q5 U! t% X5 h7 o% I

1 e$ G( D3 C, X2 @, _) h
; d% `. `( s* h% \. |3 `5 k* W
8 F- ^# v* G) S" E5 Y; E解决方法:
9 \2 }3 L  R5 y6 O8 D' t
, s* I5 ]* R* _& E6 \, x$ Z降低mysqlclient 版本,替换mysqlclient-2.0.2 为1:; K/ k) O, e) R
# g' P" g, C. R3 J
apache-airflow-providers-mysql==5.4.0
3 _, k/ e4 u4 A- u  l! W2 Gmysqlclient==2.1.0
+ h# _* V/ d* N  @2 @( S" y3 f' Y3 @- k- H

2 S8 @, y& y: z
' W, ?- e0 G6 X* b3 ~$ J9 {# E

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
 楼主| 发表于 2024-7-27 21:00:06 | 显示全部楼层
[root@python-flask ~]# pip install mysqlclient
6 Z( |  P9 j1 x  }Collecting mysqlclient$ c  _0 `$ F3 x0 p1 {: J1 B
  Using cached mysqlclient-2.2.4.tar.gz (90 kB)# O% @( U& n$ ?0 i+ M
  Installing build dependencies ... done
8 C4 u0 O1 Z, _+ D& R% N; s  Getting requirements to build wheel ... error
) Q* \* [* l) x5 u& I+ S  error: subprocess-exited-with-error3 t4 J+ b5 \" Z5 D* }6 P9 |
  1 ]6 ^& d, }& x( X5 U  O- l! P4 G. }
  × Getting requirements to build wheel did not run successfully.6 p2 t' k2 S) o( p
  │ exit code: 1
# N* j1 [2 W5 J: C' ?: P  ╰─> [27 lines of output]
1 [' S5 s4 @8 G      Trying pkg-config --exists mysqlclient" J; o. y: a; P) L* w2 w) n+ E
      Command 'pkg-config --exists mysqlclient' returned non-zero exit status 1.
7 h: _# A3 n0 B! W/ O      Trying pkg-config --exists mariadb5 Q; s9 m8 l& B8 x: Y# S
      Command 'pkg-config --exists mariadb' returned non-zero exit status 1.
# X3 x6 ]( r* v, m  {      Trying pkg-config --exists libmariadb
5 K8 R' R6 Y) J% ]3 _0 b, _7 X      Command 'pkg-config --exists libmariadb' returned non-zero exit status 1.
  X2 u: P; y( O# {( I      Traceback (most recent call last):6 ~4 \4 G' x7 R% z9 M$ n
        File "/usr/local/python312/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
% U( V  p& }1 V) \1 t% ^# w& c8 O7 K          main()' k; n+ T+ T8 C. B5 y3 |6 m; p
        File "/usr/local/python312/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main: J( R, [9 D- z* e5 w3 f3 U  Y
          json_out['return_val'] = hook(**hook_input['kwargs'])
- o8 b) T6 }, |' ?# T  v                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^2 x6 \9 l% Q" k( k7 w1 X
        File "/usr/local/python312/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
  y  Q/ W1 x) v$ Z+ F7 |0 u9 U          return hook(config_settings)( ~2 R( ?4 `. u! D# u
                 ^^^^^^^^^^^^^^^^^^^^^
5 ?: n6 |8 Y$ \( t" A        File "/tmp/pip-build-env-w2b8dsud/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 327, in get_requires_for_build_wheel
6 U' W. P! E4 G& N; ~' }% k5 |0 `          return self._get_build_requires(config_settings, requirements=[])
1 R& }: h1 }0 ^) D1 P                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  s  j# V* U1 J        File "/tmp/pip-build-env-w2b8dsud/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 297, in _get_build_requires" C$ l+ d3 o) L
          self.run_setup()6 u( n" U5 ]: p; j
        File "/tmp/pip-build-env-w2b8dsud/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 313, in run_setup" M9 d+ N; w3 w! l, F6 h
          exec(code, locals())" M3 `+ u; w& u1 P5 l+ r, _+ Z
        File "<string>", line 155, in <module>8 D6 @2 X: u, _" g$ q$ X( C
        File "<string>", line 49, in get_config_posix
7 H3 ~3 c" {, Q        File "<string>", line 28, in find_package_name* {' b+ A+ C4 ]6 r0 {
      Exception: Can not find valid pkg-config name.
* _$ ]( W2 ^' s, p3 q+ b      Specify MYSQLCLIENT_CFLAGS and MYSQLCLIENT_LDFLAGS env vars manually" H' ^1 ?# a+ ~' T7 g9 B. G
      [end of output]% L- t) D1 y) c8 L+ O
  $ |1 Q1 |9 G5 n
  note: This error originates from a subprocess, and is likely not a problem with pip.4 C4 `4 @7 V3 ^: ]- J
error: subprocess-exited-with-error
- v0 E- B" i7 P1 t
. K2 G4 b* u! ?9 b' q1 D× Getting requirements to build wheel did not run successfully.
# O2 T- A. n. L: r$ q│ exit code: 1
$ T0 D; e  u0 v/ S' |$ N╰─> See above for output.
1 u' k) J1 S, `6 u3 H! Y- d! b: H( V1 C* L$ i  U5 ]3 i# l
note: This error originates from a subprocess, and is likely not a problem with pip.
, `8 G2 G5 O, Q7 M8 Z% d[root@python-flask ~]# pip install mysqlclient==2.1.0
# j- x# D# I$ W$ xCollecting mysqlclient==2.1.0
3 O# R( L8 D( N4 q* i4 T; J  Downloading mysqlclient-2.1.0.tar.gz (87 kB)
9 z' {6 w$ L4 G- a- g* u. m     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 87.6/87.6 kB 635.5 kB/s eta 0:00:00% l. A7 d1 b# b& o" n8 p3 _
  Installing build dependencies ... done
3 p4 v5 Z, N: g0 K9 ^/ t) C2 l  Getting requirements to build wheel ... done+ m: j1 ^; z+ _. v. s$ @$ ?* `- `- u
  Preparing metadata (pyproject.toml) ... done
" T+ \! P  L% IBuilding wheels for collected packages: mysqlclient9 J! ]! v) E; b, D+ w3 e
  Building wheel for mysqlclient (pyproject.toml) ... done' i; _1 ?& D5 \- o. U1 s3 ]& j
  Created wheel for mysqlclient: filename=mysqlclient-2.1.0-cp312-cp312-linux_x86_64.whl size=102434 sha256=9195914c669fe1b57f256214d711095c10e05799fdf3b2033541f88830a69b6d
$ |0 _1 u! _8 r( g. t9 V- z  Stored in directory: /root/.cache/pip/wheels/b1/b6/8d/eb165ad207cde6784a606ec0a5bdd7a5b5c9241bad361d16231 [# s/ ^* c/ U8 ]) S( E# X" N
Successfully built mysqlclient
, v8 d0 s3 ~0 C4 {" `Installing collected packages: mysqlclient
" _& b& C% j+ s. O2 ]7 zSuccessfully installed mysqlclient-2.1.0
$ t/ w, @* r/ lWARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager, possibly rendering your system unusable.It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv. Use the --root-user-action option if you know what you are doing and want to suppress this warning.+ K5 q( Q6 z) W6 A. ~- S7 T6 T+ \

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
 楼主| 发表于 2024-7-30 02:02:53 | 显示全部楼层
安装失败还有一个原因可能是因为环境不干净导致。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

返回首页|Archiver|手机版|小黑屋|易陆发现技术论坛 ( 蜀ICP备2026014127号-1 )

GMT+8, 2026-6-12 01:53 , Processed in 0.020968 second(s), 22 queries .

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表