0

I have met a problem on mysqlclient 1.3.10 after installing libssl1.1

import MySQLdb
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/MySQLdb/__init__.py", line 19, in <module>
    import _mysql
ImportError: /usr/local/lib/python2.7/dist-packages/_mysql.so: undefined symbol: OPENSSL_add_all_algorithms_noconf

Reproduce steps:

  • On a ubuntu 14.04 machine
  • Python 2.7.6

    1. echo 'deb http://archive.mariadb.org/mariadb-10.0.29/repo/ubuntu/ trusty main' > /etc/apt/sources.list.d/mariadb.list
    2. apt-get -f install --yes --allow-unauthenticated mariadb-server
    3. Login as root and show default databases successfully
    4. add-apt-repository ppa:ondrej/php
    5. apt-get update
    6. apt-get install libssl-dev(version:1.1.0f-2~ubuntu14.04.1+deb.sury.org+1)
    7. pip install mysqlclient
    8. python -c "import MySQLdb"
henywang
  • 1
  • 2
  • https://stackoverflow.com/questions/40587558/error-installing-mysql-python-library-not-found-for-lssl – StefanE Jul 31 '17 at 12:44

1 Answers1

0

I found a workaround to skip this import error.

  1. apt-get install python-mysqldb. It will create a _mysql.so at /usr/lib/python2.7/dist-packages/

  2. Pip install MySQL-python=1.2.3

  3. mv /usr/local/lib/python2.7/dist-packages/_mysql.so /home/
  4. cp /usr/lib/python2.7/dist-packages/_mysql.so /usr/local/lib/python2.7/dist-packages/
  5. chmod a+x /usr/local/lib/python2.7/dist-packages/_mysql.so
henywang
  • 1
  • 2