pip install mysql Error - error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\VC\\Tools\\MSVC\\14.12.25827\\bin\\HostX86\\x86\\cl.exe' failed with exit status 2

已回答

After several days of researching and trying to resolve the following error, "Cannot open include file: 'config-win.h"  - followed by the recommendation to install Visual Studio Build Tools (VSBT) . It has been a hit 'n miss to try and install exactly which VSBT should be installed, short of installing everything (even the components that is not required.

The short question is: what are the exact VSBT components that I require?

Development Platform:

Windows 10 + Raspberry Pi 3B running Stretch

 

I have done the following on the HP 360 Spectre - Windows 10:

1. Upgraded PyCharm to the latest version 2017.3.3 

2. Upgraded Python to Python 3.6.3 (v3.6.3:2c5fed8, Oct 3 2017, 17:26:49) [MSC v.1900 32 bit (Intel)] on win32

3. Installed Visual Studio Build Tools - 2017 - 15.5.5

 

 I have done the following on the Raspberry Pi:

1. Upgrade the Raspberry Pi to Stretch - clean install - 

Linux raspberrypi 4.9.59-v7+ #1047 SMP Sun Oct 29 12:19:23 GMT 2017 armv7l

 

2. Python 3.5.3 (default, Jan 19 2017, 14:11:04)

 

 

-----------------------------------------------

Collecting mysql
Collecting MySQL-python (from mysql)
Using cached MySQL-python-1.2.5.zip
Building wheels for collected packages: MySQL-python
Running setup.py bdist_wheel for MySQL-python: started
Running setup.py bdist_wheel for MySQL-python: finished with status 'error'
Complete output from command "C:\Users\Harvey Keown\AppData\Local\Programs\Python\Python36-32\python.exe" -u -c "import setuptools, tokenize;__file__='C:\\Users\\HARVEY~1\\AppData\\Local\\Temp\\pycharm-packaging\\MySQL-python\\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\HARVEY~1\AppData\Local\Temp\tmpampldbqlpip-wheel- --python-tag cp36:
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\converters.py -> build\lib.win32-3.6\MySQLdb
copying MySQLdb\connections.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\CR.py -> build\lib.win32-3.6\MySQLdb\constants
copying MySQLdb\constants\FIELD_TYPE.py -> build\lib.win32-3.6\MySQLdb\constants
copying MySQLdb\constants\ER.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
copying MySQLdb\constants\CLIENT.py -> build\lib.win32-3.6\MySQLdb\constants
warning: build_py: byte-compiling is disabled, skipping.

running build_ext
building '_mysql' extension
creating build\temp.win32-3.6
creating build\temp.win32-3.6\Release
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.12.25827\bin\HostX86\x86\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 "-IC:\Program Files (x86)\MySQL\MySQL Connector C 6.0.2\include" "-IC:\Users\Harvey Keown\AppData\Local\Programs\Python\Python36-32\include" "-IC:\Users\Harvey Keown\AppData\Local\Programs\Python\Python36-32\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.12.25827\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\winrt" /Tc_mysql.c /Fobuild\temp.win32-3.6\Release\_mysql.obj /Zl
_mysql.c
_mysql.c(42): fatal error C1083: Cannot open include file: 'config-win.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\VC\\Tools\\MSVC\\14.12.25827\\bin\\HostX86\\x86\\cl.exe' failed with exit status 2

----------------------------------------
Running setup.py clean for MySQL-python
Failed to build MySQL-python
Installing collected packages: MySQL-python, mysql
Running setup.py install for MySQL-python: started
Running setup.py install for MySQL-python: finished with status 'error'
Complete output from command "C:\Users\Harvey Keown\AppData\Local\Programs\Python\Python36-32\python.exe" -u -c "import setuptools, tokenize;__file__='C:\\Users\\HARVEY~1\\AppData\\Local\\Temp\\pycharm-packaging\\MySQL-python\\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\HARVEY~1\AppData\Local\Temp\pip-5zok9gev-record\install-record.txt --single-version-externally-managed --compile:
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\converters.py -> build\lib.win32-3.6\MySQLdb
copying MySQLdb\connections.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\CR.py -> build\lib.win32-3.6\MySQLdb\constants
copying MySQLdb\constants\FIELD_TYPE.py -> build\lib.win32-3.6\MySQLdb\constants
copying MySQLdb\constants\ER.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
copying MySQLdb\constants\CLIENT.py -> build\lib.win32-3.6\MySQLdb\constants
warning: build_py: byte-compiling is disabled, skipping.

running build_ext
building '_mysql' extension
creating build\temp.win32-3.6
creating build\temp.win32-3.6\Release
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.12.25827\bin\HostX86\x86\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 "-IC:\Program Files (x86)\MySQL\MySQL Connector C 6.0.2\include" "-IC:\Users\Harvey Keown\AppData\Local\Programs\Python\Python36-32\include" "-IC:\Users\Harvey Keown\AppData\Local\Programs\Python\Python36-32\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.12.25827\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\winrt" /Tc_mysql.c /Fobuild\temp.win32-3.6\Release\_mysql.obj /Zl
_mysql.c
_mysql.c(42): fatal error C1083: Cannot open include file: 'config-win.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\VC\\Tools\\MSVC\\14.12.25827\\bin\\HostX86\\x86\\cl.exe' failed with exit status 2

----------------------------------------

Failed building wheel for MySQL-python
Command ""C:\Users\Harvey Keown\AppData\Local\Programs\Python\Python36-32\python.exe" -u -c "import setuptools, tokenize;__file__='C:\\Users\\HARVEY~1\\AppData\\Local\\Temp\\pycharm-packaging\\MySQL-python\\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\HARVEY~1\AppData\Local\Temp\pip-5zok9gev-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\HARVEY~1\AppData\Local\Temp\pycharm-packaging\MySQL-python\

0

Hello Harvey,

Please try to install the package from the command line for the same interpreter as you use in Pycharm. Do you have the same error?

0

Hi Anna,

 

I get exactly the same error. 

 

Regarding the installation of Visual Studio Build Tools (VSBT) - I would like to know what are the absolute minimum individual modules that I should install. The installation of VSBT has been a trial an error installation, with much frustration. So I want to eliminate the VSBT by installing the exact required individual modules.


0

Hi Anna,

 

Any progress regarding exactly which Visual Studio Build Tools (VSBT) individual modules should be installed? 

0

Hello Harvey! Thank you for the update.
> I get exactly the same error. 
If you got the same error in the command line, it means that the problem is not related to PyCharm. To solve the problem you could check the related threads on Stack Overflow: https://stackoverflow.com/questions/26866147/mysql-python-install-error-cannot-open-include-file-config-win-h/31077052https://stackoverflow.com/questions/1972259/cannot-open-include-file-config-win-h-no-such-file-or-directory-while-inst or start a new thread there.

0

请先登录再写评论。