mysql 未找到连接器

mysql connector not found

我正在使用 Python3,我尝试使用此命令安装 mysql.connector

pip install mysql-connector-python-rf

但是当我 运行 代码时,我得到 ModuleNotFoundError: No module named 'mysql'

如果我输入 pip search mysql-connector-python 它会找到这个版本:

mysql-connector-python (8.0.20)               - MySQL driver written in Python
  INSTALLED: 8.0.20 (latest)
mysql-connector (2.2.9)                       - MySQL driver written in Python
beam-mysql-connector (1.8.2)                  - MySQL I/O Connector of Apache Beam
mysql-connector-python-dd (2.0.2)             - MySQL driver written in Python
  INSTALLED: 2.0.2 (latest)
mysql-connector-python-rf (2.2.2)             - MySQL driver written in Python
  INSTALLED: 2.2.2 (latest)
MySQL-python (1.2.5)                          - Python interface to MySQL
mysql-connector-repackaged (0.3.1)            - MySQL driver written in Python

我错过了什么??

我尝试安装多个版本的mysql-connector,但是,我发现了问题。我不得不 更改配置 将解释器设置为默认位置 并使用 [=10= 再次安装 mysql-connector ]

PyPI 中的官方 MySQL Connector/Python 是 mysql-connector-python。所以 pip install mysql-connector-python 是要走的路。