从jupyterhub连接mysql时,得到mysql的modulenotfounderror

nr9pn0ug  于 2021-06-24  发布在  Mysql
关注(0)|答案(0)|浏览(362)

我在使用mysql而不是sqlite进行jupyterhub会话和令牌存储时遇到了这个错误。

[E 2018-06-27 06:04:36.542 JupyterHub app:1623]
jupyterhub4cc    |     Traceback (most recent call last):
jupyterhub4cc    |       File "/usr/local/lib/python3.6/dist-packages/jupyterhub/app.py", line 1620, in launch_instance_async
jupyterhub4cc    |         yield self.initialize(argv)
jupyterhub4cc    |       File "/usr/lib/python3.6/types.py", line 204, in __next__
jupyterhub4cc    |         return next(self.__wrapped)
jupyterhub4cc    |       File "/usr/local/lib/python3.6/dist-packages/jupyterhub/app.py", line 1373, in initialize
jupyterhub4cc    |         self.init_db()
jupyterhub4cc    |       File "/usr/local/lib/python3.6/dist-packages/jupyterhub/app.py", line 895, in init_db
jupyterhub4cc    |       **self.db_kwargs
jupyterhub4cc    |       File "/usr/local/lib/python3.6/dist-packages/jupyterhub/orm.py", line 526, in new_session_factory
jupyterhub4cc    |         engine = create_engine(url,**kwargs)
jupyterhub4cc    |       File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/engine/__init__.py", line 424, in create_engine
jupyterhub4cc    |         return strategy.create(*args,**kwargs)
jupyterhub4cc    |       File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/engine/strategies.py", line 81, in create
jupyterhub4cc    |         dbapi = dialect_cls.dbapi(**dbapi_args)
jupyterhub4cc    |       File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/dialects/mysql/mysqlconnector.py", line 107, in dbapi
jupyterhub4cc    |         from mysql import connector
jupyterhub4cc    |     ModuleNotFoundError: No module named 'mysql'

我在jupyterhub容器中使用了这三个库来连接mysql。
mysql python
mysql连接器python
pymysql数据库
使用的配置是:

c.JupyterHub.db_url = 'mysql+mysqlconnector://{}:{}@{}/{}{}'.format("test","test","localhost","test","")

p、 我已经在本地安装了mysql服务器,并创建了一个数据库test,用户名test,密码test。

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题