欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

pymysqlclient 提示Microsoft Visual C++ 14.0 is required问题

程序员文章站 2022-05-06 18:20:03
...
C:\Users\zhengk>pip install mysqlclient
Collecting mysqlclient
  Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x03B1C050>: Failed to establish a new connection: [Errno 11002] getaddrinfo failed',)': /simple/mysqlclient/
  Downloading https://files.pythonhosted.org/packages/ec/fd/83329b9d3e14f7344d1cb31f128e6dbba70c5975c9e57896815dbb1988ad/mysqlclient-1.3.13.tar.gz (90kB)
    100% |████████████████████████████████| 92kB 4.3kB/s
Building wheels for collected packages: mysqlclient
  Running setup.py bdist_wheel for mysqlclient ... error
  Complete output from command d:\software\python\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\zhengk\\AppData\\Local\\Temp\\pip-install-88poub55\\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\zhengk\AppData\Local\Temp\pip-wheel-njpn_rjk --python-tag cp36:
  d:\software\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.win32-3.6
  copying _mysql_exceptions.py -> build\lib.win32-3.6
  creating build\lib.win32-3.6\MySQLdb
  copying MySQLdb\__init__.py -> build\lib.win32-3.6\MySQLdb
  copying MySQLdb\compat.py -> build\lib.win32-3.6\MySQLdb
  copying MySQLdb\connections.py -> build\lib.win32-3.6\MySQLdb
  copying MySQLdb\converters.py -> build\lib.win32-3.6\MySQLdb
  copying MySQLdb\cursors.py -> build\lib.win32-3.6\MySQLdb
  copying MySQLdb\release.py -> build\lib.win32-3.6\MySQLdb
  copying MySQLdb\times.py -> build\lib.win32-3.6\MySQLdb
  creating build\lib.win32-3.6\MySQLdb\constants
  copying MySQLdb\constants\__init__.py -> build\lib.win32-3.6\MySQLdb\constants
  copying MySQLdb\constants\CLIENT.py -> build\lib.win32-3.6\MySQLdb\constants
  copying MySQLdb\constants\CR.py -> build\lib.win32-3.6\MySQLdb\constants
  copying MySQLdb\constants\ER.py -> build\lib.win32-3.6\MySQLdb\constants
  copying MySQLdb\constants\FIELD_TYPE.py -> build\lib.win32-3.6\MySQLdb\constants
  copying MySQLdb\constants\FLAG.py -> build\lib.win32-3.6\MySQLdb\constants
  copying MySQLdb\constants\REFRESH.py -> build\lib.win32-3.6\MySQLdb\constants
  running build_ext
  building '_mysql' extension
  error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools

  ----------------------------------------
  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
    Complete output from command d:\software\python\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\zhengk\\AppData\\Local\\Temp\\pip-install-88poub55\\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\zhengk\AppData\Local\Temp\pip-record-l6ai19vs\install-record.txt --single-version-externally-managed --compile:
    d:\software\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.win32-3.6
    copying _mysql_exceptions.py -> build\lib.win32-3.6
    creating build\lib.win32-3.6\MySQLdb
    copying MySQLdb\__init__.py -> build\lib.win32-3.6\MySQLdb
    copying MySQLdb\compat.py -> build\lib.win32-3.6\MySQLdb
    copying MySQLdb\connections.py -> build\lib.win32-3.6\MySQLdb
    copying MySQLdb\converters.py -> build\lib.win32-3.6\MySQLdb
    copying MySQLdb\cursors.py -> build\lib.win32-3.6\MySQLdb
    copying MySQLdb\release.py -> build\lib.win32-3.6\MySQLdb
    copying MySQLdb\times.py -> build\lib.win32-3.6\MySQLdb
    creating build\lib.win32-3.6\MySQLdb\constants
    copying MySQLdb\constants\__init__.py -> build\lib.win32-3.6\MySQLdb\constants
    copying MySQLdb\constants\CLIENT.py -> build\lib.win32-3.6\MySQLdb\constants
    copying MySQLdb\constants\CR.py -> build\lib.win32-3.6\MySQLdb\constants
    copying MySQLdb\constants\ER.py -> build\lib.win32-3.6\MySQLdb\constants
    copying MySQLdb\constants\FIELD_TYPE.py -> build\lib.win32-3.6\MySQLdb\constants
    copying MySQLdb\constants\FLAG.py -> build\lib.win32-3.6\MySQLdb\constants
    copying MySQLdb\constants\REFRESH.py -> build\lib.win32-3.6\MySQLdb\constants
    running build_ext
    building '_mysql' extension
    error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools

    ----------------------------------------
Command "d:\software\python\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\zhengk\\AppData\\Local\\Temp\\pip-install-88poub55\\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\zhengk\AppData\Local\Temp\pip-record-l6ai19vs\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\zhengk\AppData\Local\Temp\pip-install-88poub55\mysqlclient\

解决方案

这个时候直接到以下地址下载对应的库,然后离线pip install即可

https://www.lfd.uci.edu/~gohlke/pythonlibs/#pymssql

32位的下载win32,64位的下载win_amd64
cp36后面36代表python3.6
mysqlclient‑1.3.13‑cp36‑cp36m‑win32.whl
mysqlclient‑1.3.13‑cp36‑cp36m‑win_amd64.whl
pymysqlclient 提示Microsoft Visual C++ 14.0 is required问题

cd到你下载的目录
pip install pymssql-2.1.3-cp36-cp36m-win32.whl
相关标签: python mysql c++