【问题标题】:Why is import of msql-connector failing even though it was successfully installed?为什么即使安装成功,导入 mysql-connector 也会失败?
【发布时间】:2018-05-24 00:55:32
【问题描述】:

我正在尝试使用here 提供的说明安装python-myconnector

安装成功:

(my_virtual_env)[my.username@my-machine ~]$ pip install mysql-connector
...
Successfully installed mysql-connector

但是,当我尝试使用它时,导入 mysql.connector 模块失败。什么??为什么???

(my_virtual_env)[my.username@my-machine ~]$ python
Python 2.7.12 (default, Sep  1 2016, 22:14:00)


>>> import mysql.connector
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named mysql.connector

Here是安装和使用的完整日志。

【问题讨论】:

    标签: python mysql-connector


    【解决方案1】:
    pip install mysql-connector-python
    

    这在 python 2.7.12 venv 中对我有用。

    你也可以看到关于这个here的讨论。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-05-22
      • 2020-07-13
      • 1970-01-01
      • 2015-01-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多