【问题标题】:mysql connector not found未找到 mysql 连接器
【发布时间】:2020-05-09 20:41:43
【问题描述】:

我正在使用 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

我错过了什么?

【问题讨论】:

标签: python mysql-connector mysql-connector-python


【解决方案1】:

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

【讨论】:

    【解决方案2】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-01-27
      • 1970-01-01
      • 2018-10-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-07
      相关资源
      最近更新 更多