【问题标题】:Microsoft Visual C++ 14.0 is required - installing mysqldb for python需要 Microsoft Visual C++ 14.0 - 为 python 安装 mysqldb
【发布时间】:2019-07-12 23:57:48
【问题描述】:

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

    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/

【问题讨论】:

标签: python visual-c++ pycharm mysql-python


【解决方案1】:

我从来没有弄清楚这个问题,但我相信这与我的机器上同时安装了 Python2 和 Python3 有关。我卸载了 Python3,并能够通过更多的努力让事情正常进行。希望当我们迁移到 Python3 时,我不会再遇到这个问题。

【讨论】:

    【解决方案2】:

    如果你想安装数据库,我会去微软网页 (https://dev.mysql.com/doc/refman/8.0/en/windows-installation.html) 并从那里安装它。

    据我所知,你不能通过 python 的 pip 安装数据库。

    【讨论】:

      猜你喜欢
      • 2019-02-02
      • 1970-01-01
      • 2018-04-25
      • 2020-08-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-06-10
      相关资源
      最近更新 更多