在尝试安装MySQL客户端时,我在导入sys、setuptools和tokenize时遇到了这个错误

2024-05-12 16:12:27 发布

您现在位置:Python中文网/ 问答频道 /正文

ERROR: Command errored out with exit status 1:
   command: 'c:\users\xbox\appdata\local\programs\python\python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\xbox\\AppData\\Local\\Temp\\pip-install-mdag86we\\mysqlclient\\setup.py'"'"'; __file__='"'"'C:\\Users\\xbox\\AppData\\Local\\Temp\\pip-install-mdag86we\\mysqlclient\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\xbox\AppData\Local\Temp\pip-wheel-142_jc37'
       cwd: C:\Users\xbox\AppData\Local\Temp\pip-install-mdag86we\mysqlclient\
  Complete output (30 lines):
  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\compat.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
  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\2019\Community\VC\Tools\MSVC\14.25.28610\bin\HostX86\x86\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Dversion_info=(1,4,6,'final',0) -D__version__=1.4.6 "-IC:\Program Files (x86)\MySQL\MySQL Connector C 6.1\include\mariadb" -Ic:\users\xbox\appdata\local\programs\python\python38-32\include -Ic:\users\xbox\appdata\local\programs\python\python38-32\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" /TcMySQLdb/_mysql.c /Fobuild\temp.win32-3.8\Release\MySQLdb/_mysql.obj /Zl /D_CRT_SECURE_NO_WARNINGS
  _mysql.c
  C:\Program Files (x86)\MySQL\MySQL Connector C 6.1\include\mariadb\mysql.h(38): fatal error C1083: Cannot open include file: 'sys/types.h': No such file or directory
  error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.25.28610\\bin\\HostX86\\x86\\cl.exe' failed with exit status 2
  ----------------------------------------
  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: 'c:\users\xbox\appdata\local\programs\python\python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\xbox\\AppData\\Local\\Temp\\pip-install-mdag86we\\mysqlclient\\setup.py'"'"'; __file__='"'"'C:\\Users\\xbox\\AppData\\Local\\Temp\\pip-install-mdag86we\\mysqlclient\\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\xbox\AppData\Local\Temp\pip-record-ydguff01\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\xbox\appdata\local\programs\python\python38-32\Include\mysqlclient'
         cwd: C:\Users\xbox\AppData\Local\Temp\pip-install-mdag86we\mysqlclient\
    Complete output (30 lines):
    running install
    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\compat.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
    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\2019\Community\VC\Tools\MSVC\14.25.28610\bin\HostX86\x86\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Dversion_info=(1,4,6,'final',0) -D__version__=1.4.6 "-IC:\Program Files (x86)\MySQL\MySQL Connector C 6.1\include\mariadb" -Ic:\users\xbox\appdata\local\programs\python\python38-32\include -Ic:\users\xbox\appdata\local\programs\python\python38-32\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" /TcMySQLdb/_mysql.c /Fobuild\temp.win32-3.8\Release\MySQLdb/_mysql.obj /Zl /D_CRT_SECURE_NO_WARNINGS
    _mysql.c
    C:\Program Files (x86)\MySQL\MySQL Connector C 6.1\include\mariadb\mysql.h(38): fatal error C1083: Cannot open include file: 'sys/types.h': No such file or directory
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.25.28610\\bin\\HostX86\\x86\\cl.exe' failed with exit status 2
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\xbox\appdata\local\programs\python\python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\xbox\\AppData\\Local\\Temp\\pip-install-mdag86we\\mysqlclient\\setup.py'"'"'; __file__='"'"'C:\\Users\\xbox\\AppData\\Local\\Temp\\pip-install-mdag86we\\mysqlclient\\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\xbox\AppData\Local\Temp\pip-record-ydguff01\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\xbox\appdata\local\programs\python\python38-32\Include\mysqlclient' Check the logs for full command output.

我已经查看了当前的帖子,并被建议安装mariaDB和MySQL连接器。我将lib和include目录放在MySQL连接器lib和include目录中。我得到了这个错误,需要定位mysql.h。我检查了一些相关的帖子,但真的找不到解决这个错误的方法。有人能帮我吗?我将如何导入这些工具?是否有关于此错误来源的推测


Tags: installpybuildcreatingincludelibprogramx86