【问题标题】:Error connecting Python with MySQL将 Python 与 MySQL 连接时出错
【发布时间】:2018-08-19 11:45:25
【问题描述】:

我收到了一个 python 项目,但在运行它的要求时遇到了问题,尤其是与 MySQL 相关的任何要求。每当我运行 pip install mysqlclient 时,都会收到 13 条警告,并且此错误为红色。

Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-build-eBsQYy/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 /tmp/pip-sxHiel-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/tmp/pip-build-eBsQYy/mysqlclient/

当我运行 pip install mysql-python 时,我收到 14 个警告,并带有类似的红色错误。

Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-build-qW79lT/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 /tmp/pip-13maVa-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/tmp/pip-build-qW79lT/mysql-python/

有什么想法吗?

【问题讨论】:

  • 你在本地安装了MYSQL吗?
  • @JerinPeterGeorge 是的,我用 brew 安装了它,最好的检查方法是什么?

标签: python mysql django installation mysql-python


【解决方案1】:

尝试安装“pymysql”。我也收到了警告,尝试在 Python 3 中安装 MySQL for Python。在做了一些研究之后,pymysql 似乎是需要安装的东西。点安装 pymysql。

【讨论】:

  • 这似乎不起作用:(我安装了pymsql,但仍然出现错误。
猜你喜欢
  • 2016-09-03
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-06-26
  • 2015-10-11
  • 2017-06-24
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多