安装mysqlclient报错

来源:4-11 快速运行小程序图文指导

qq_抱着盒子的姑娘_0

2019-11-17

  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回答

编程浪子

2019-11-17

你好


在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
2
不好好学习就找不到对象
pymysql和mysqlclient的区别是啥
2020-03-06
共2条回复

Python Flask构建微信小程序订餐系统(可用于毕设)

微信小程序 + Python Flask 打造订餐系统全栈应用,可用于毕设。

1709 学习 · 1889 问题

查看课程