需要Microsoft Visual C ++ 14.0-为python安装mysqldb

时间:2019-02-19 12:59:22

标签: python pycharm mysql-python

我正在Windows 10中尝试使用pip MySQL-python进行安装,如下所示。有人告诉我我需要Microsoft Visual C ++ 14,但是我已经安装了Microsoft Visual Studio 11、12和2017。如果我的研究正确的话,2017年应该为我提供必需的组件。我也安装了Microsoft Build Tools。我茫然什么是错的。我正在尝试使用PyCharm从Ubuntu VM迁移到本机Windows。我见过很多其他问题,但似乎没有一个我需要的答案。

enter image description here

    C:\Environment\Python27>pip install MySQL-python
Collecting MySQL-python
  Using cached https://files.pythonhosted.org/packages/a5/e9/51b544da85a36a68debe7a7091f068d802fc515a3a202652828c73453cad/MySQL-python-1.2.5.zip
Installing collected packages: MySQL-python
  Running setup.py install for MySQL-python ... error
    Complete output from command c:\users\efultz\appdata\local\programs\python\python37\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\efultz\\AppData\\Local\\Temp\\pip-build-3d7yo7lf\\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\efultz\AppData\Local\Temp\pip-wcici6ff-record\install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.7
    copying _mysql_exceptions.py -> build\lib.win-amd64-3.7
    creating build\lib.win-amd64-3.7\MySQLdb
    copying MySQLdb\__init__.py -> build\lib.win-amd64-3.7\MySQLdb
    copying MySQLdb\converters.py -> build\lib.win-amd64-3.7\MySQLdb
    copying MySQLdb\connections.py -> build\lib.win-amd64-3.7\MySQLdb
    copying MySQLdb\cursors.py -> build\lib.win-amd64-3.7\MySQLdb
    copying MySQLdb\release.py -> build\lib.win-amd64-3.7\MySQLdb
    copying MySQLdb\times.py -> build\lib.win-amd64-3.7\MySQLdb
    creating build\lib.win-amd64-3.7\MySQLdb\constants
    copying MySQLdb\constants\__init__.py -> build\lib.win-amd64-3.7\MySQLdb\constants
    copying MySQLdb\constants\CR.py -> build\lib.win-amd64-3.7\MySQLdb\constants
    copying MySQLdb\constants\FIELD_TYPE.py -> build\lib.win-amd64-3.7\MySQLdb\constants
    copying MySQLdb\constants\ER.py -> build\lib.win-amd64-3.7\MySQLdb\constants
    copying MySQLdb\constants\FLAG.py -> build\lib.win-amd64-3.7\MySQLdb\constants
    copying MySQLdb\constants\REFRESH.py -> build\lib.win-amd64-3.7\MySQLdb\constants
    copying MySQLdb\constants\CLIENT.py -> build\lib.win-amd64-3.7\MySQLdb\constants
    running build_ext
    building '_mysql' extension
    error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/

2 个答案:

答案 0 :(得分:0)

我从来没有发现问题,但是我相信这与在我的机器上同时安装Python2和Python3有关。我卸载了Python3,并付出了更多的努力才能使工作正常。希望当我们迁移到Python3时,我不会再遇到这个问题。

答案 1 :(得分:-1)

如果要安装数据库,我将转到Microsoft网页(https://dev.mysql.com/doc/refman/8.0/en/windows-installation.html)并从那里安装它。

据我所知,您无法通过python的pip安装数据库。

相关问题