Python 3.8.5 和 MYSQLDB

标签 python mysql-python

最近,我一直在尝试在 Pycharm 上设置 MySQLDB。我安装了 Python 3.8.5,并确保设置了 PATH,一切似乎都很顺利。之后,我运行了 pip 命令。

python -m pip install mysqldbpython -m pip install mysqldb-python

但是没有效果。

我尝试从 Pycharm 的解释器页面安装它,但也没有成功。我还尝试使用 .whl 文件进行安装,但这也失败了。在过去的几天里,我进行了广泛的搜索,并且发现了有关此错误的提及,但我所见过的修复都没有真正起作用。无论我尝试安装哪个版本,我得到的错误都是相同的。在我看到的所有指南中,除了我所做的事情之外,我从未看到任何提及我错过的步骤或在尝试安装之前应该做的事情。错误如下。

ERROR: Could not find a version that satisfies the requirement MySQLdb (from versions: none)
DEPRECATION: The -b/--build/--build-dir/--build-directory option is deprecated. pip 20.3 will remove support for this functionality. A possible replacement is use the TMPDIR/TEMP/TMP environment variable, possibly combined with --no-clean. You can find discussion regarding this at https://github.com/pypa/pip/issues/8333.
ERROR: Could not find a version that satisfies the requirement MySQLdb (from versions: none)
ERROR: No matching distribution found for MySQLdb

最佳答案

您可以尝试安装以下内容,

pip install pymysql
pip install mysql-connector
pip install mysql-connector-python

或者您可以访问 lfd.uci.edu/~gohlke/pythonlibs/#mysql-python 并安装轮子。

关于Python 3.8.5 和 MYSQLDB,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64067502/

相关文章:

python - 安装 mysql-python 时出错

mysql - 如何捕获由于 mysql 数据中无效的连续字节而导致的 UnicodeDecodeError

python - 如何在 Windows 10 上安装 mysql-python

python - 如何从 pandas 数据框内的列表中调用值?

Python 嵌套生成器

来自 ANTLR 解析树的 Python AST?

Python MySQL 连接器不适用于 SSL

Python - 使用 BeautifulSoup 在页面中抓取多个类

python - 字典中的错误求和值

Python MySQLdb : Iterating over a cursor