I have tried 2 commands:
pip install mysql-python
and
pip install mysqlclient
Error for the pip install mysql-python
Command "C:\Users\Pops\Desktop\Martin\Programming\Python\venv\Scripts\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Pops\\AppData\\Local\\Temp\\pip-install-zfndvw17\\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\Pops\AppData\Local\Temp\pip-reco
rd-jpu7d9zb\install-record.txt --single-version-externally-managed --compile --install-headers C:\Users\Pops\Desktop\Martin\Programming\Python\venv\include\site\python3.7\mysql-python" failed with er
ror code 1 in C:\Users\Pops\AppData\Local\Temp\pip-install-zfndvw17\mysql-python\
Error for the pip install mysqlclient
Command "C:\Users\Pops\Desktop\Martin\Programming\Python\venv\Scripts\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Pops\\AppData\\Local\\Temp\\pip-install-cn_nm0np\\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\Pops\AppData\Local\Temp\pip-recor
d-lyzr49kh\install-record.txt --single-version-externally-managed --compile --install-headers C:\Users\Pops\Desktop\Martin\Programming\Python\venv\include\site\python3.7\mysqlclient" failed with erro
r code 1 in C:\Users\Pops\AppData\Local\Temp\pip-install-cn_nm0np\mysqlclient\
This is the download portion and seems to work fine until the end. (Just putting this here to fill-up more non-code text for stackoverflow to accept the revision)
Top portion prior to error:
Collecting mysqlclient
Downloading https://files.pythonhosted.org/packages/ec/fd/83329b9d3e14f7344d1cb31f128e6dbba70c5975c9e57896815dbb1988ad/mysqlclient-1.3.13.tar.gz (90kB)
100% |████████████████████████████████| 92kB 168kB/s
Installing collected packages: mysqlclient
Running setup.py install for mysqlclient ... error
Complete output from command C:\Users\Pops\Desktop\Martin\Programming\Python\venv\Scripts\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Pops\\AppData\\Local\\Temp\\pip-instal
l-cn_nm0np\\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\Pops\AppD
ata\Local\Temp\pip-record-lyzr49kh\install-record.txt --single-version-externally-managed --compile --install-headers C:\Users\Pops\Desktop\Martin\Programming\Python\venv\include\site\python3.7\mysql
client:
C:\Users\Pops\AppData\Local\Programs\Python\Python37-32\lib\distutils\dist.py:274: 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.7
copying _mysql_exceptions.py -> build\lib.win32-3.7
creating build\lib.win32-3.7\MySQLdb
copying MySQLdb\__init__.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\compat.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\connections.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\converters.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\cursors.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\release.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\times.py -> build\lib.win32-3.7\MySQLdb
creating build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\__init__.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\CLIENT.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\CR.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\ER.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\FIELD_TYPE.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\FLAG.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\REFRESH.py -> build\lib.win32-3.7\MySQLdb\constants
running build_ext
building '_mysql' extension
creating build\temp.win32-3.7
creating build\temp.win32-3.7\Release
cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MT -Dversion_info=(1,3,13,'final',0) -D__version__=1.3.13 "-IC:\Program Files (x86)\MySQL\MySQL Connector C 6.1\include" -IC:\Users\Pops\Desktop\Martin\Pro
gramming\Python\venv\include -IC:\Users\Pops\AppData\Local\Programs\Python\Python37-32\include -IC:\Users\Pops\AppData\Local\Programs\Python\Python37-32\include "-IC:\Program Files (x86)\Windows Kits
10円\include10円.0.16299.0\shared" "-IC:\Program Files (x86)\Windows Kits10円\include10円.0.16299.0\um" "-IC:\Program Files (x86)\Windows Kits10円\include10円.0.16299.0\winrt" "-IC:\Program Files (x86)\Win
dows Kits10円\include10円.0.16299.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK4円.6.1\include\um" /Tc_mysql.c /Fobuild\temp.win32-3.7\Release\_mysql.obj /Zl
error: command 'cl.exe' failed: No such file or directory
----------------------------------------
2 Answers 2
You have to add cl.exe into your PATH. It is generally located in (visual studio folder)\VC\bin directory. Add that to your PATH variable using the steps in here. After this restart the command prompt and you can use cl.exe from command prompt.
Alternatively you can download unofficial windows binaries for mysqlclient from https://www.lfd.uci.edu/~gohlke/pythonlibs/#mysqlclient. And Install using pip install "path to the downloaded whl file"
13 Comments
bin folder. The paths for mine are: C:\Program Files (x86)\Microsoft Visual Studio2017円\Community\Common7\IDE\VC and C:\Program Files (x86)\Microsoft Visual Studio2017円\Community\VC but there are no bin folders for bothbin folder after the Microsoft Visual Studio2017円\Community\VC\Tools\MSVC14円.12.25827 and inside the folders there's no cl.exe. I don't have a 14.10.25017 folder as well only the one stated aboveAs I mentioned in the comment, you need to cl.exe folder. You can do it through Visual Studio installer. Install the following C++ compilers:
mysqlclientmodule manually, extracting it and runningpython ./setup.pyto see more detailed error messages.python ./setup.pyin the terminal?