首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法导入mysql.connector - ModuleNotFoundError:没有名为'mysql‘的模块

无法导入mysql.connector - ModuleNotFoundError:没有名为'mysql‘的模块
EN

Stack Overflow用户
提问于 2021-10-11 04:26:20
回答 1查看 80关注 0票数 0

import mysql.connector出现以下错误。

代码语言:javascript
复制
import mysql.connector
ModuleNotFoundError: No module named 'mysql'

但是,以下命令显示mysql已安装?

代码语言:javascript
复制
(env) bash-4.2$ pip list | grep mysql
mysql (0.0.3)
mysqlclient (2.0.3)

(env) bash-4.2$ conda list mysql
WARNING conda.core.prefix_data:_load_site_packages(272): Problem reading non-conda package record at lib/python3.6/site-packages/pyzmq-17.0.0-py3.6.egg-info/PKG-INFO. Please verify that you still need this, and if so, that this is still installed correctly. Reinstalling this package may help.
WARNING conda.core.prefix_data:_load_site_packages(272): Problem reading non-conda package record at lib/python3.6/site-packages/jupyterlab-2.3.1-py3.9.egg-info/PKG-INFO. Please verify that you still need this, and if so, that this is still installed correctly. Reinstalling this package may help.
WARNING conda.core.prefix_data:_load_site_packages(272): Problem reading non-conda package record at lib/python3.6/site-packages/conda-4.10.3-py3.6.egg-info/PKG-INFO. Please verify that you still need this, and if so, that this is still installed correctly. Reinstalling this package may help.
WARNING conda.core.prefix_data:_load_site_packages(272): Problem reading non-conda package record at lib/python3.6/site-packages/certifi-2021.5.30-py3.6.egg-info/PKG-INFO. Please verify that you still need this, and if so, that this is still installed correctly. Reinstalling this package may help.
# packages in environment at /apps/external/4/anaconda3:
#
# Name                    Version                   Build  Channel
mysql                     5.7.20               h55eaa98_0    https://mycompany.intranet/repository/anaconda-main-proxy

顺便说一下,为什么pip mysql的版本这么低?(0.0.3)

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-10-11 04:35:00

pip安装mysql-connector或不使您的.py文件名: mysql.py或类似的东西。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69521027

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档