Python MySQLdb not importing

前端 未结 7 1602
无人及你
无人及你 2021-01-01 07:34

I have installed mysql server using

$ sudo apt-get install mysql-server

then I installed python-mysqldb using

$ sudo apt-ge         


        
相关标签:
7条回答
  • 2021-01-01 08:23

    "mysql-python" currently does not support python3. There are currently a few options for using Python 3 with mysql. I installed mysqlclient and can import MySQLdb successfully.

    $ pip install mysqlclient
    
    $ python
    Python 3.6.9 (default, Nov  7 2019, 10:44:02) 
    [GCC 8.3.0] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import MySQLdb
    >>> 
    

    Details refer to: https://stackoverflow.com/a/25724855/966660

    0 讨论(0)
提交回复
热议问题