请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

安装mysqlclient报错

  1. 使用用得虚拟环境
  2. python是3.5的
  3. 报错信息如下
 ERROR: Command errored out with exit status 1:
   command: 'd:\programming_language\python\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\ZHUHON~1\\AppData\\Local\\Temp\\pip-install-zrauigfz\\mysqlclient\\setup.py'"'"'; __file__='"'"'C:\\Users\\ZHUHON~1\\AppData\\Local\\Temp\\pip-install-zrauigfz\\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\ZHUHON~1\AppData\Local\Temp\pip-wheel-enumbw08' --python-tag cp35
       cwd: C:\Users\ZHUHON~1\AppData\Local\Temp\pip-install-zrauigfz\mysqlclient\
  Complete output (26 lines):
  d:\programming_language\python\lib\distutils\dist.py:261: UserWarning: Unknown distribution option: 'long_description_content_type'
    warnings.warn(msg)
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-3.5
  creating build\lib.win-amd64-3.5\MySQLdb
  copying MySQLdb\__init__.py -> build\lib.win-amd64-3.5\MySQLdb
  copying MySQLdb\_exceptions.py -> build\lib.win-amd64-3.5\MySQLdb
  copying MySQLdb\compat.py -> build\lib.win-amd64-3.5\MySQLdb
  copying MySQLdb\connections.py -> build\lib.win-amd64-3.5\MySQLdb
  copying MySQLdb\converters.py -> build\lib.win-amd64-3.5\MySQLdb
  copying MySQLdb\cursors.py -> build\lib.win-amd64-3.5\MySQLdb
  copying MySQLdb\release.py -> build\lib.win-amd64-3.5\MySQLdb
  copying MySQLdb\times.py -> build\lib.win-amd64-3.5\MySQLdb
  creating build\lib.win-amd64-3.5\MySQLdb\constants
  copying MySQLdb\constants\__init__.py -> build\lib.win-amd64-3.5\MySQLdb\constants
  copying MySQLdb\constants\CLIENT.py -> build\lib.win-amd64-3.5\MySQLdb\constants
  copying MySQLdb\constants\CR.py -> build\lib.win-amd64-3.5\MySQLdb\constants
  copying MySQLdb\constants\ER.py -> build\lib.win-amd64-3.5\MySQLdb\constants
  copying MySQLdb\constants\FIELD_TYPE.py -> build\lib.win-amd64-3.5\MySQLdb\constants
  copying MySQLdb\constants\FLAG.py -> build\lib.win-amd64-3.5\MySQLdb\constants
  running build_ext
  building 'MySQLdb._mysql' extension
  error: Unable to find vcvarsall.bat
  ----------------------------------------
  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: 'd:\programming_language\python\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\ZHUHON~1\\AppData\\Local\\Temp\\pip-install-zrauigfz\\mysqlclient\\setup.py'"'"'; __file__='"'"'C:\\Users\\ZHUHON~1\\AppData\\Local\\Temp\\pip-install-zrauigfz\\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\ZHUHON~1\AppData\Local\Temp\pip-record-dtw798pt\install-record.txt' --single-version-externally-managed --compile
         cwd: C:\Users\ZHUHON~1\AppData\Local\Temp\pip-install-zrauigfz\mysqlclient\
    Complete output (26 lines):
    d:\programming_language\python\lib\distutils\dist.py:261: UserWarning: Unknown distribution option: 'long_description_content_type'
      warnings.warn(msg)
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.5
    creating build\lib.win-amd64-3.5\MySQLdb
    copying MySQLdb\__init__.py -> build\lib.win-amd64-3.5\MySQLdb
    copying MySQLdb\_exceptions.py -> build\lib.win-amd64-3.5\MySQLdb
    copying MySQLdb\compat.py -> build\lib.win-amd64-3.5\MySQLdb
    copying MySQLdb\connections.py -> build\lib.win-amd64-3.5\MySQLdb
    copying MySQLdb\converters.py -> build\lib.win-amd64-3.5\MySQLdb
    copying MySQLdb\cursors.py -> build\lib.win-amd64-3.5\MySQLdb
    copying MySQLdb\release.py -> build\lib.win-amd64-3.5\MySQLdb
    copying MySQLdb\times.py -> build\lib.win-amd64-3.5\MySQLdb
    creating build\lib.win-amd64-3.5\MySQLdb\constants
    copying MySQLdb\constants\__init__.py -> build\lib.win-amd64-3.5\MySQLdb\constants
    copying MySQLdb\constants\CLIENT.py -> build\lib.win-amd64-3.5\MySQLdb\constants
    copying MySQLdb\constants\CR.py -> build\lib.win-amd64-3.5\MySQLdb\constants
    copying MySQLdb\constants\ER.py -> build\lib.win-amd64-3.5\MySQLdb\constants
    copying MySQLdb\constants\FIELD_TYPE.py -> build\lib.win-amd64-3.5\MySQLdb\constants
    copying MySQLdb\constants\FLAG.py -> build\lib.win-amd64-3.5\MySQLdb\constants
    running build_ext
    building 'MySQLdb._mysql' extension
    error: Unable to find vcvarsall.bat
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'd:\programming_language\python\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\ZHUHON~1\\AppData\\Local\\Temp\\pip-install-zrauigfz\\mysqlclient\\setup.py'"'"'; __file__='"'"'C:\\Users\\ZHUHON~1\\AppData\\Local\\Temp\\pip-install-zrauigfz\\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\ZHUHON~1\AppData\Local\Temp\pip-record-dtw798pt\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.

正在回答

1回答

你好


在windows10,终端pip install mysqlclient 时,是安装不了mysqlclient这个库的,需要在https://pypi.org/project/mysqlclient/#files中下载相应系统的whl文件 。然后pip install 下载的whl文件


打开Python官网找到Pypi然后搜索mysqlclient,下载下来,命令行切换到下载目录,执行pip install mysqlclient就装好了



也可以试试 pip install pymysql


1 回复 有任何疑惑可以回复我~
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信