最近,我一直在尝试在 Pycharm 上设置 MySQLDB
。我安装了 Python 3.8.5,并确保设置了 PATH,一切似乎都很顺利。之后,我运行了 pip 命令。
python -m pip install mysqldb
和
python -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/