升级到Ubuntu 16.04现在MySQL-python依赖项被破坏了

时间:2022-08-03 23:40:05

I just upgraded my Ubuntu install to 16.04 and this seems to have broken my mysql dependencies in the MySQL-python package.

我刚刚将我的Ubuntu安装升级到16.04,这似乎打破了MySQL-python包中的mysql依赖项。

Here is my error message:

这是我的错误消息:

  File "/opt/monitorenv/local/lib/python2.7/site-packages/sqlalchemy/engine/__init__.py", line 386, in create_engine
return strategy.create(*args, **kwargs)
  File "/opt/monitorenv/local/lib/python2.7/site-packages/sqlalchemy/engine/strategies.py", line 75, in create
dbapi = dialect_cls.dbapi(**dbapi_args)
  File "/opt/monitorenv/local/lib/python2.7/site-packages/sqlalchemy/dialects/mysql/mysqldb.py", line 92, in dbapi
return __import__('MySQLdb')
  File "/opt/monitorenv/local/lib/python2.7/site-packages/MySQLdb/__init__.py", line 19, in <module>
    import _mysql
ImportError: libmysqlclient.so.18: cannot open shared object file: No such file or directory

So basically the import_mysql is looking for an so file that doesn't exist because in Ubuntu 16.04, I have libmysqlclient20 installed. And libmysqlclient18 is not available. As far as I am aware (or at least I believe) my python libraries are up to date with the latest versions.

所以基本上import_mysql正在寻找一个不存在的so文件,因为在Ubuntu 16.04中,我安装了libmysqlclient20。并且libmysqlclient18不可用。据我所知(或者至少我相信)我的python库是最新的版本。

(I tried running pip install --upgrade mysql-python which indicated it was up to date).

(我尝试运行pip install --upgrade mysql-python,表明它是最新的)。

Do you guys have any suggestions ?

你们有什么建议吗?

4 个解决方案

#1


26  

Thank for Largaroth. If you use mysqlclient on Ubuntu 16.04 and have error: ImportError: libmysqlclient.so.18: cannot open shared object file: No such file or directory

感谢Largaroth。如果你在Ubuntu 16.04上使用mysqlclient并且有错误:ImportError:libmysqlclient.so.18:无法打开共享对象文件:没有这样的文件或目录

You can fix:

你可以解决:

sudo -H pip uninstall mysqlclient

sudo -H pip install --no-binary mysqlclient mysqlclient

#2


23  

I ended up finding the solution to my problems with pip install --no-binary MySQL-python MySQL-python as stated in this thread : Python's MySQLdb can’t find libmysqlclient.dylib with Homebrewed MySQL

我最终找到解决我的问题的pip install --no-binary MySQL-python MySQL-python如此线程中所述:Python的MySQLdb无法找到libmysqlclient.dylib与Homebrewed MySQL

#3


4  

I had the same issue. I uninstalled and reinstalled MySQL-python:

我遇到过同样的问题。我卸载并重新安装了MySQL-python:

pip uninstall MySQL-python
pip install MySQL-python

#4


1  

My problem was that I was using wheelhouse from old OS.

我的问题是我使用旧操作系统的驾驶室。

The problem was solved when I uninstalled/installed the package or updated wheelhouse...

当我卸载/安装包或更新的驾驶室时问题解决了......

From docs:

来自docs:

http://mysql-python.sourceforge.net/FAQ.html#importerror

http://mysql-python.sourceforge.net/FAQ.html#importerror

This means you have a version of MySQLdb compiled against one version of MySQL, and are now trying to run it against a different version. The shared library version tends to change between major releases.

这意味着你有一个版本的MySQLdb针对一个版本的MySQL编译,现在正试图针对不同的版本运行它。共享库版本往往在主要版本之间发生变化。

Solution: Rebuilt MySQLdb, or get the matching version of MySQL.

解决方案:重建MySQLdb,或获取匹配的MySQL版本。

#1


26  

Thank for Largaroth. If you use mysqlclient on Ubuntu 16.04 and have error: ImportError: libmysqlclient.so.18: cannot open shared object file: No such file or directory

感谢Largaroth。如果你在Ubuntu 16.04上使用mysqlclient并且有错误:ImportError:libmysqlclient.so.18:无法打开共享对象文件:没有这样的文件或目录

You can fix:

你可以解决:

sudo -H pip uninstall mysqlclient

sudo -H pip install --no-binary mysqlclient mysqlclient

#2


23  

I ended up finding the solution to my problems with pip install --no-binary MySQL-python MySQL-python as stated in this thread : Python's MySQLdb can’t find libmysqlclient.dylib with Homebrewed MySQL

我最终找到解决我的问题的pip install --no-binary MySQL-python MySQL-python如此线程中所述:Python的MySQLdb无法找到libmysqlclient.dylib与Homebrewed MySQL

#3


4  

I had the same issue. I uninstalled and reinstalled MySQL-python:

我遇到过同样的问题。我卸载并重新安装了MySQL-python:

pip uninstall MySQL-python
pip install MySQL-python

#4


1  

My problem was that I was using wheelhouse from old OS.

我的问题是我使用旧操作系统的驾驶室。

The problem was solved when I uninstalled/installed the package or updated wheelhouse...

当我卸载/安装包或更新的驾驶室时问题解决了......

From docs:

来自docs:

http://mysql-python.sourceforge.net/FAQ.html#importerror

http://mysql-python.sourceforge.net/FAQ.html#importerror

This means you have a version of MySQLdb compiled against one version of MySQL, and are now trying to run it against a different version. The shared library version tends to change between major releases.

这意味着你有一个版本的MySQLdb针对一个版本的MySQL编译,现在正试图针对不同的版本运行它。共享库版本往往在主要版本之间发生变化。

Solution: Rebuilt MySQLdb, or get the matching version of MySQL.

解决方案:重建MySQLdb,或获取匹配的MySQL版本。