首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >OSError:在Fedora上安装mysqldb 1.3.7时找不到mysql_config

OSError:在Fedora上安装mysqldb 1.3.7时找不到mysql_config
EN

Stack Overflow用户
提问于 2021-07-02 08:02:22
回答 1查看 481关注 0票数 0

对于一个项目,我必须安装一个特定版本的mysqlclient==1.3.7。然而,我发现了一些错误:似乎缺少了mysql_config

代码语言:javascript
运行
复制
(venv) [ac@localmachine data-tools]$ python -m pip install mysqlclient==1.3.7
Collecting mysqlclient==1.3.7
  Using cached mysqlclient-1.3.7.tar.gz (79 kB)
    ERROR: Command errored out with exit status 1:
     command: /home/ac/Documents/Programming/Work/data-tools/venv/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-tso5g_cy/mysqlclient_4957ca0023294aaf907cc37f2312dd8c/setup.py'"'"'; __file__='"'"'/tmp/pip-install-tso5g_cy/mysqlclient_4957ca0023294aaf907cc37f2312dd8c/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-dt7pv4kk
         cwd: /tmp/pip-install-tso5g_cy/mysqlclient_4957ca0023294aaf907cc37f2312dd8c/
    Complete output (10 lines):
    /bin/sh: line 1: mysql_config: command not found
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-tso5g_cy/mysqlclient_4957ca0023294aaf907cc37f2312dd8c/setup.py", line 17, in <module>
        metadata, options = get_config()
      File "/tmp/pip-install-tso5g_cy/mysqlclient_4957ca0023294aaf907cc37f2312dd8c/setup_posix.py", line 44, in get_config
        libs = mysql_config("libs_r")
      File "/tmp/pip-install-tso5g_cy/mysqlclient_4957ca0023294aaf907cc37f2312dd8c/setup_posix.py", line 26, in mysql_config
        raise EnvironmentError("%s not found" % (mysql_config.path,))
    OSError: mysql_config not found
    ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/74/ff/4e964e20b559e55d7afa60fbccc6a560f2adf289813bd3d7eb4eb8a87093/mysqlclient-1.3.7.tar.gz#sha256=c74a83b4cb2933d0e43370117eeebdfa03077ae72686d2df43d31879267f1f1b (from https://pypi.org/simple/mysqlclient/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement mysqlclient==1.3.7 (from versions: 1.3.0, 1.3.1, 1.3.2, 1.3.3, 1.3.4, 1.3.5, 1.3.6, 1.3.7, 1.3.8, 1.3.9, 1.3.10, 1.3.11rc1, 1.3.11, 1.3.12, 1.3.13, 1.3.14, 1.4.0rc1, 1.4.0rc2, 1.4.0rc3, 1.4.0, 1.4.1, 1.4.2, 1.4.2.post1, 1.4.3, 1.4.4, 1.4.5, 1.4.6, 2.0.0, 2.0.1, 2.0.2, 2.0.3)
ERROR: No matching distribution found for mysqlclient==1.3.7

因此,我安装了community-mysql-devel并重新运行了它:

代码语言:javascript
运行
复制
(venv) [ac@localmachine data-tools]$ python -m pip install mysqlclient==1.3.7
Collecting mysqlclient==1.3.7
  Using cached mysqlclient-1.3.7.tar.gz (79 kB)
Using legacy 'setup.py install' for mysqlclient, since package 'wheel' is not installed.
Installing collected packages: mysqlclient
    Running setup.py install for mysqlclient ... error
    ERROR: Command errored out with exit status 1:
     command: /home/ac/Documents/Programming/Work/data-tools/venv/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-7okc9y_x/mysqlclient_b4db68125912451d81875f39d142c9ee/setup.py'"'"'; __file__='"'"'/tmp/pip-install-7okc9y_x/mysqlclient_b4db68125912451d81875f39d142c9ee/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-znhsqlja/install-record.txt --single-version-externally-managed --compile --install-headers /home/ac/Documents/Programming/Work/data-tools/venv/include/site/python3.9/mysqlclient
         cwd: /tmp/pip-install-7okc9y_x/mysqlclient_b4db68125912451d81875f39d142c9ee/
    Complete output (35 lines):
    /home/ac/Documents/Programming/Work/data-tools/venv/lib64/python3.9/site-packages/setuptools/dist.py:691: UserWarning: Usage of dash-separated 'distribution-name' will not be supported in future versions. Please use the underscore name 'distribution_name' instead
      warnings.warn(
    /home/ac/Documents/Programming/Work/data-tools/venv/lib64/python3.9/site-packages/setuptools/dist.py:691: UserWarning: Usage of dash-separated 'build-requires' will not be supported in future versions. Please use the underscore name 'build_requires' instead
      warnings.warn(
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.9
    copying _mysql_exceptions.py -> build/lib.linux-x86_64-3.9
    creating build/lib.linux-x86_64-3.9/MySQLdb
    copying MySQLdb/__init__.py -> build/lib.linux-x86_64-3.9/MySQLdb
    copying MySQLdb/compat.py -> build/lib.linux-x86_64-3.9/MySQLdb
    copying MySQLdb/converters.py -> build/lib.linux-x86_64-3.9/MySQLdb
    copying MySQLdb/connections.py -> build/lib.linux-x86_64-3.9/MySQLdb
    copying MySQLdb/cursors.py -> build/lib.linux-x86_64-3.9/MySQLdb
    copying MySQLdb/release.py -> build/lib.linux-x86_64-3.9/MySQLdb
    copying MySQLdb/times.py -> build/lib.linux-x86_64-3.9/MySQLdb
    creating build/lib.linux-x86_64-3.9/MySQLdb/constants
    copying MySQLdb/constants/__init__.py -> build/lib.linux-x86_64-3.9/MySQLdb/constants
    copying MySQLdb/constants/CR.py -> build/lib.linux-x86_64-3.9/MySQLdb/constants
    copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-3.9/MySQLdb/constants
    copying MySQLdb/constants/ER.py -> build/lib.linux-x86_64-3.9/MySQLdb/constants
    copying MySQLdb/constants/FLAG.py -> build/lib.linux-x86_64-3.9/MySQLdb/constants
    copying MySQLdb/constants/REFRESH.py -> build/lib.linux-x86_64-3.9/MySQLdb/constants
    copying MySQLdb/constants/CLIENT.py -> build/lib.linux-x86_64-3.9/MySQLdb/constants
    running build_ext
    building '_mysql' extension
    creating build/temp.linux-x86_64-3.9
    gcc -pthread -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC -Dversion_info=(1,3,7,'final',1) -D__version__=1.3.7 -I/usr/include/mysql -I/home/ac/Documents/Programming/Work/data-tools/venv/include -I/usr/include/python3.9 -c _mysql.c -o build/temp.linux-x86_64-3.9/_mysql.o -m64
    _mysql.c:29:10: fatal error: my_config.h: No such file or directory
       29 | #include "my_config.h"
          |          ^~~~~~~~~~~~~
    compilation terminated.
    error: command '/usr/bin/gcc' failed with exit code 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: 
/home/ac/Documents/Programming/Work/data-tools/venv/bin/python -u -c 
'import io, os, sys, setuptools, tokenize; sys.argv[0] = 
'"'"'/tmp/pip-install 7okc9y_x/mysqlclient_b4db68125912451d81875f39d142c9ee/setup.py'"'"'; __file__='"'"'/tmp/pip-install okc9y_x/mysqlclient_b4db68125912451d81875f39d142c9ee/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-znhsqlja/install-record.txt --single-version-externally-managed --compile --install-headers /home/ac/Documents/Programming/Work/data-tools/venv/include/site/python3.9/mysqlclient Check the logs for full command output.

由于轮子似乎缺少,我也试着安装它:

代码语言:javascript
运行
复制
(venv) [ac@localmachine data-tools]$ python -m pip install wheel
Collecting wheel
  Downloading wheel-0.36.2-py2.py3-none-any.whl (35 kB)
Installing collected packages: wheel
Successfully installed wheel-0.36.2

但这还不够

代码语言:javascript
运行
复制
(venv) [ac@localmachine data-tools]$ python -m pip install mysqlclient==1.3.7
Collecting mysqlclient==1.3.7
  Using cached mysqlclient-1.3.7.tar.gz (79 kB)
Building wheels for collected packages: mysqlclient
  Building wheel for mysqlclient (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /home/ac/Documents/Programming/Work/data-tools/venv/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-6n9fzb6y/mysqlclient_c3d7b33fbad748f1b57a8ca294cb6ea1/setup.py'"'"'; __file__='"'"'/tmp/pip-install-6n9fzb6y/mysqlclient_c3d7b33fbad748f1b57a8ca294cb6ea1/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-_20ndtkd
       cwd: /tmp/pip-install-6n9fzb6y/mysqlclient_c3d7b33fbad748f1b57a8ca294cb6ea1/
  Complete output (35 lines):
  /home/ac/Documents/Programming/Work/data-tools/venv/lib64/python3.9/site-packages/setuptools/dist.py:691: UserWarning: Usage of dash-separated 'distribution-name' will not be supported in future versions. Please use the underscore name 'distribution_name' instead
    warnings.warn(
  /home/ac/Documents/Programming/Work/data-tools/venv/lib64/python3.9/site-packages/setuptools/dist.py:691: UserWarning: Usage of dash-separated 'build-requires' will not be supported in future versions. Please use the underscore name 'build_requires' instead
    warnings.warn(
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.9
  copying _mysql_exceptions.py -> build/lib.linux-x86_64-3.9
  creating build/lib.linux-x86_64-3.9/MySQLdb
  ...
  running build_ext
  building '_mysql' extension
  creating build/temp.linux-x86_64-3.9
  gcc -pthread -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -... I/home/ac/Documents/Programming/Work/data-tools/venv/include -I/usr/include/python3.9 -c _mysql.c -o build/temp.linux-x86_64-3.9/_mysql.o -m64
  _mysql.c:29:10: fatal error: my_config.h: No such file or directory
     29 | #include "my_config.h"
        |          ^~~~~~~~~~~~~
  compilation terminated.
  error: command '/usr/bin/gcc' failed with exit code 1
 ...
    _mysql.c:29:10: fatal error: my_config.h: No such file or directory
       29 | #include "my_config.h"
          |          ^~~~~~~~~~~~~
    compilation terminated.
    error: command '/usr/bin/gcc' failed with exit code 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /home/ac/Documents/Programming/Work/data-tools/venv/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-6n9fzb6y/mysqlclient_c3d7b33fbad748f1b57a8ca294cb6ea1/setup.py'"'"'; __file__='"'"'/tmp/pip-install-6n9fzb6y/mysqlclient_c3d7b33fbad748f1b57a8ca294cb6ea1/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-9xyqzh6s/install-record.txt --single-version-externally-managed --compile --install-headers /home/ac/Documents/Programming/Work/data-tools/venv/include/site/python3.9/mysqlclient Check the logs for full command output.

更新

我确保一切都好:

代码语言:javascript
运行
复制
(venv) [ac@localmachine data-tools]$ python -m pip install mysqlclient==1.3.7
Collecting mysqlclient==1.3.7
  Using cached mysqlclient-1.3.7.tar.gz (79 kB)
Building wheels for collected packages: mysqlclient
  Building wheel for mysqlclient (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /home/ac/Documents/Programming/Work/data-tools/venv/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-oc0b_tf0/mysqlclient_3c668220085e4790813f0fbf24ad3d06/setup.py'"'"'; __file__='"'"'/tmp/pip-install-oc0b_tf0/mysqlclient_3c668220085e4790813f0fbf24ad3d06/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-0vacq2_s
       cwd: /tmp/pip-install-oc0b_tf0/mysqlclient_3c668220085e4790813f0fbf24ad3d06/
  Complete output (81 lines):
  /home/ac/Documents/Programming/Work/data-tools/venv/lib64/python3.9/site-packages/setuptools/dist.py:697: UserWarning: Usage of dash-separated 'distribution-name' will not be supported in future versions. Please use the underscore name 'distribution_name' instead
    warnings.warn(
  /home/ac/Documents/Programming/Work/data-tools/venv/lib64/python3.9/site-packages/setuptools/dist.py:697: UserWarning: Usage of dash-separated 'build-requires' will not be supported in future versions. Please use the underscore name 'build_requires' instead
    warnings.warn(
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.9
  copying _mysql_exceptions.py -> build/lib.linux-x86_64-3.9
  creating build/lib.linux-x86_64-3.9/MySQLdb
  copying MySQLdb/__init__.py -> build/lib.linux-x86_64-3.9/MySQLdb
  copying MySQLdb/compat.py -> build/lib.linux-x86_64-3.9/MySQLdb
  copying MySQLdb/converters.py -> build/lib.linux-x86_64-3.9/MySQLdb
  copying MySQLdb/connections.py -> build/lib.linux-x86_64-3.9/MySQLdb
  copying MySQLdb/cursors.py -> build/lib.linux-x86_64-3.9/MySQLdb
  copying MySQLdb/release.py -> build/lib.linux-x86_64-3.9/MySQLdb
  copying MySQLdb/times.py -> build/lib.linux-x86_64-3.9/MySQLdb
  creating build/lib.linux-x86_64-3.9/MySQLdb/constants
  copying MySQLdb/constants/__init__.py -> build/lib.linux-x86_64-3.9/MySQLdb/constants
  copying MySQLdb/constants/CR.py -> build/lib.linux-x86_64-3.9/MySQLdb/constants
  copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-3.9/MySQLdb/constants
  copying MySQLdb/constants/ER.py -> build/lib.linux-x86_64-3.9/MySQLdb/constants
  copying MySQLdb/constants/FLAG.py -> build/lib.linux-x86_64-3.9/MySQLdb/constants
  copying MySQLdb/constants/REFRESH.py -> build/lib.linux-x86_64-3.9/MySQLdb/constants
  copying MySQLdb/constants/CLIENT.py -> build/lib.linux-x86_64-3.9/MySQLdb/constants
  running build_ext
  building '_mysql' extension
  creating build/temp.linux-x86_64-3.9
  gcc -pthread -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC -Dversion_info=(1,3,7,'final',1) -D__version__=1.3.7 -I/usr/include/mysql -I/usr/include/mysql/mysql -I/home/ac/Documents/Programming/Work/data-tools/venv/include -I/usr/include/python3.9 -c _mysql.c -o build/temp.linux-x86_64-3.9/_mysql.o
  In file included from _mysql.c:29:
  /usr/include/mysql/my_config.h:3:2: warning: #warning This file should not be included by clients, include only <mysql.h> [-Wcpp]
      3 | #warning This file should not be included by clients, include only <mysql.h>
        |  ^~~~~~~
  _mysql.c: In function ‘_mysql_server_init’:
  _mysql.c:275:27: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
    275 |                         s = PyUnicode_AsUTF8(item);
        |                           ^
  _mysql.c:305:27: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
    305 |                         s = PyUnicode_AsUTF8(item);
        |                           ^
  _mysql.c: In function ‘_mysql_ConnectionObject_Initialize’:
  _mysql.c:589:16: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
    589 |         if(t){d=PyUnicode_AsUTF8(t);Py_DECREF(t);}\
        |                ^
  _mysql.c:600:17: note: in expansion of macro ‘_stringsuck’
    600 |                 _stringsuck(ca, value, ssl);
        |                 ^~~~~~~~~~~
  _mysql.c:589:16: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
    589 |         if(t){d=PyUnicode_AsUTF8(t);Py_DECREF(t);}\
        |                ^
  _mysql.c:601:17: note: in expansion of macro ‘_stringsuck’
    601 |                 _stringsuck(capath, value, ssl);
        |                 ^~~~~~~~~~~
  _mysql.c:589:16: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
    589 |         if(t){d=PyUnicode_AsUTF8(t);Py_DECREF(t);}\
        |                ^
  _mysql.c:602:17: note: in expansion of macro ‘_stringsuck’
    602 |                 _stringsuck(cert, value, ssl);
        |                 ^~~~~~~~~~~
  _mysql.c:589:16: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
    589 |         if(t){d=PyUnicode_AsUTF8(t);Py_DECREF(t);}\
        |                ^
  _mysql.c:603:17: note: in expansion of macro ‘_stringsuck’
    603 |                 _stringsuck(key, value, ssl);
        |                 ^~~~~~~~~~~
  _mysql.c:589:16: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
    589 |         if(t){d=PyUnicode_AsUTF8(t);Py_DECREF(t);}\
        |                ^
  _mysql.c:604:17: note: in expansion of macro ‘_stringsuck’
    604 |                 _stringsuck(cipher, value, ssl);
        |                 ^~~~~~~~~~~
  _mysql.c: In function ‘_mysql_ConnectionObject_ping’:
  _mysql.c:1968:48: error: ‘MYSQL’ {aka ‘struct st_mysql’} has no member named ‘reconnect’
   1968 |         if ( reconnect != -1 ) self->connection.reconnect = reconnect;
        |                                                ^
  _mysql.c: In function ‘_mysql_ConnectionObject_getattro’:
  _mysql.c:2675:15: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
   2675 |         cname = PyUnicode_AsUTF8(name);
        |               ^
  error: command '/usr/bin/gcc' failed with exit code 1
  ----------------------------------------
  ERROR: Failed building wheel for mysqlclient
  Running setup.py clean for mysqlclient
Failed to build mysqlclient
Installing collected packages: mysqlclient
    Running setup.py install for mysqlclient ... error
    ERROR: Command errored out with exit status 1:
     command: /home/ac/Documents/Programming/Work/data-tools/venv/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-oc0b_tf0/mysqlclient_3c668220085e4790813f0fbf24ad3d06/setup.py'"'"'; __file__='"'"'/tmp/pip-install-oc0b_tf0/mysqlclient_3c668220085e4790813f0fbf24ad3d06/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-yhrboba8/install-record.txt --single-version-externally-managed --compile --install-headers /home/ac/Documents/Programming/Work/data-tools/venv/include/site/python3.9/mysqlclient
         cwd: /tmp/pip-install-oc0b_tf0/mysqlclient_3c668220085e4790813f0fbf24ad3d06/
    Complete output (81 lines):
    /home/ac/Documents/Programming/Work/data-tools/venv/lib64/python3.9/site-packages/setuptools/dist.py:697: UserWarning: Usage of dash-separated 'distribution-name' will not be supported in future versions. Please use the underscore name 'distribution_name' instead
      warnings.warn(
    /home/ac/Documents/Programming/Work/data-tools/venv/lib64/python3.9/site-packages/setuptools/dist.py:697: UserWarning: Usage of dash-separated 'build-requires' will not be supported in future versions. Please use the underscore name 'build_requires' instead
      warnings.warn(
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.9
    copying _mysql_exceptions.py -> build/lib.linux-x86_64-3.9
    creating build/lib.linux-x86_64-3.9/MySQLdb
    copying MySQLdb/__init__.py -> build/lib.linux-x86_64-3.9/MySQLdb
    copying MySQLdb/compat.py -> build/lib.linux-x86_64-3.9/MySQLdb
    copying MySQLdb/converters.py -> build/lib.linux-x86_64-3.9/MySQLdb
    copying MySQLdb/connections.py -> build/lib.linux-x86_64-3.9/MySQLdb
    copying MySQLdb/cursors.py -> build/lib.linux-x86_64-3.9/MySQLdb
    copying MySQLdb/release.py -> build/lib.linux-x86_64-3.9/MySQLdb
    copying MySQLdb/times.py -> build/lib.linux-x86_64-3.9/MySQLdb
    creating build/lib.linux-x86_64-3.9/MySQLdb/constants
    copying MySQLdb/constants/__init__.py -> build/lib.linux-x86_64-3.9/MySQLdb/constants
    copying MySQLdb/constants/CR.py -> build/lib.linux-x86_64-3.9/MySQLdb/constants
    copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-3.9/MySQLdb/constants
    copying MySQLdb/constants/ER.py -> build/lib.linux-x86_64-3.9/MySQLdb/constants
    copying MySQLdb/constants/FLAG.py -> build/lib.linux-x86_64-3.9/MySQLdb/constants
    copying MySQLdb/constants/REFRESH.py -> build/lib.linux-x86_64-3.9/MySQLdb/constants
    copying MySQLdb/constants/CLIENT.py -> build/lib.linux-x86_64-3.9/MySQLdb/constants
    running build_ext
    building '_mysql' extension
    creating build/temp.linux-x86_64-3.9
    gcc -pthread -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC -Dversion_info=(1,3,7,'final',1) -D__version__=1.3.7 -I/usr/include/mysql -I/usr/include/mysql/mysql -I/home/ac/Documents/Programming/Work/data-tools/venv/include -I/usr/include/python3.9 -c _mysql.c -o build/temp.linux-x86_64-3.9/_mysql.o
    In file included from _mysql.c:29:
    /usr/include/mysql/my_config.h:3:2: warning: #warning This file should not be included by clients, include only <mysql.h> [-Wcpp]
        3 | #warning This file should not be included by clients, include only <mysql.h>
          |  ^~~~~~~
    _mysql.c: In function ‘_mysql_server_init’:
    _mysql.c:275:27: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
      275 |                         s = PyUnicode_AsUTF8(item);
          |                           ^
    _mysql.c:305:27: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
      305 |                         s = PyUnicode_AsUTF8(item);
          |                           ^
    _mysql.c: In function ‘_mysql_ConnectionObject_Initialize’:
    _mysql.c:589:16: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
      589 |         if(t){d=PyUnicode_AsUTF8(t);Py_DECREF(t);}\
          |                ^
    _mysql.c:600:17: note: in expansion of macro ‘_stringsuck’
      600 |                 _stringsuck(ca, value, ssl);
          |                 ^~~~~~~~~~~
    _mysql.c:589:16: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
      589 |         if(t){d=PyUnicode_AsUTF8(t);Py_DECREF(t);}\
          |                ^
    _mysql.c:601:17: note: in expansion of macro ‘_stringsuck’
      601 |                 _stringsuck(capath, value, ssl);
          |                 ^~~~~~~~~~~
    _mysql.c:589:16: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
      589 |         if(t){d=PyUnicode_AsUTF8(t);Py_DECREF(t);}\
          |                ^
    _mysql.c:602:17: note: in expansion of macro ‘_stringsuck’
      602 |                 _stringsuck(cert, value, ssl);
          |                 ^~~~~~~~~~~
    _mysql.c:589:16: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
      589 |         if(t){d=PyUnicode_AsUTF8(t);Py_DECREF(t);}\
          |                ^
    _mysql.c:603:17: note: in expansion of macro ‘_stringsuck’
      603 |                 _stringsuck(key, value, ssl);
          |                 ^~~~~~~~~~~
    _mysql.c:589:16: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
      589 |         if(t){d=PyUnicode_AsUTF8(t);Py_DECREF(t);}\
          |                ^
    _mysql.c:604:17: note: in expansion of macro ‘_stringsuck’
      604 |                 _stringsuck(cipher, value, ssl);
          |                 ^~~~~~~~~~~
    _mysql.c: In function ‘_mysql_ConnectionObject_ping’:
    _mysql.c:1968:48: error: ‘MYSQL’ {aka ‘struct st_mysql’} has no member named ‘reconnect’
     1968 |         if ( reconnect != -1 ) self->connection.reconnect = reconnect;
          |                                                ^
    _mysql.c: In function ‘_mysql_ConnectionObject_getattro’:
    _mysql.c:2675:15: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
     2675 |         cname = PyUnicode_AsUTF8(name);
          |               ^
    error: command '/usr/bin/gcc' failed with exit code 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /home/ac/Documents/Programming/Work/data-tools/venv/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-oc0b_tf0/mysqlclient_3c668220085e4790813f0fbf24ad3d06/setup.py'"'"'; __file__='"'"'/tmp/pip-install-oc0b_tf0/mysqlclient_3c668220085e4790813f0fbf24ad3d06/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-yhrboba8/install-record.txt --single-version-externally-managed --compile --install-headers /home/ac/Documents/Programming/Work/data-tools/venv/include/site/python3.9/mysqlclient Check the logs for full command output.
EN

回答 1

Stack Overflow用户

发布于 2022-02-27 00:31:21

我遵循这些步骤让它起作用..。

将MySQL回购添加到Fedora:

sudo dnf install https://repo.mysql.com//mysql80-community-release-fc31-1.noarch.rpm

已安装的MySQL:

sudo dnf install mysql-community-server

安装了开发头:

sudo dnf install mysql-community-devel

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/68221652

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档