本篇內容主要講解“Python如何安裝mariadb對應的MySQLdb擴展”,感興趣的朋友不妨來看看。本文介紹的方法操作簡單快捷,實用性強。下面就讓小編來帶大家學習“Python如何安裝mariadb對應的MySQLdb擴展”吧!
成都創(chuàng)新互聯(lián)主營黃山網站建設的網絡公司,主營網站建設方案,成都App制作,黃山h5小程序制作搭建,黃山網站營銷推廣歡迎黃山等地區(qū)企業(yè)咨詢
debian下安裝
比如網上的方案是:
apt-get install libmysql-dev apt-get install libmysqlclient-dev apt-get install python-dev pip install mysqlclient
這些命令一般情況下是沒問題的,但是本機上安裝的是maraidb,那就扯淡了
MariaDB [(none)]> select version(); +--------------------------+ | version() | +--------------------------+ | 10.1.38-MariaDB-0+deb9u1 | +--------------------------+
搜索apt的源發(fā)現(xiàn)沒有相應的libmysql-dev 之類的,搜索如下:
ljf@ljf:/var/www/python$ sudo apt-cache search libmysql libglpk40 - linear programming kit with integer (MIP) support libcrypt-mysql-perl - Perl module to emulate the MySQL PASSWORD() function libmysql-diff-perl - module for comparing the table structure of two MySQL databases libreoffice-base-drivers - Database connectivity drivers for LibreOffice solr-common - Enterprise search server based on Lucene3 - common files libmariadbclient-dev-compat - MariaDB database development files (libmysqlclient compatibility) libmysql++-dev - MySQL C++ library bindings (development) libmysql++-doc - MySQL C++ library bindings (documentation and examples) libmysql++3v5 - MySQL C++ library bindings (runtime) libmysqlcppconn-dev - MySQL Connector for C++ (development files) libmysqlcppconn7v5 - MySQL Connector for C++ (library) libmysql-java - Java database (JDBC) driver for MySQL libmysql-cil-dev - MySQL database connector for CLI libmysql6.4-cil - MySQL database connector for CLI default-libmysqlclient-dev - MySQL database development files (metapackage) libmysql-ocaml - OCaml bindings for MySql (runtime package) libmysql-ocaml-dev - OCaml bindings for MySql (development package) node-mysql - MySQL client implementation for Node.js
搜索出來的源感覺不是那么對,但是有個源的名稱叫:libmariadbclient-dev-compat ,那么會不會是要下載libmariadb的源文件呢,搜索下libmariadb對應的擴展看看:
ljf@ljf:/var/www/python$ sudo apt-cache search libmariadb libmariadbclient-dev - MariaDB database development files libmariadbclient-dev-compat - MariaDB database development files (libmysqlclient compatibility) libmariadbclient18 - MariaDB database client library libmariadbd-dev - MariaDB embedded database, development files libmariadbd18 - MariaDB embedded database, shared library libmariadb-dev - MariaDB Connector/C, development files libmariadb-dev-compat - MariaDB Connector/C, compatibility symlinks libmariadb2 - MariaDB Connector/C default-libmysqlclient-dev - MySQL database development files (metapackage)
果然libmariadb的源文件和推薦命令十分相似,安裝試試:
apt-get install libmariadbd-dev apt-get install libmariadbdclient-dev apt-get install python-dev pip install mysqlclient
執(zhí)行完畢之后,測試:
ljf@ljf:/var/www/python$ python Python 2.7.13 (default, Sep 26 2018, 18:42:22) [GCC 6.3.0 20170516] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import MySQLdb >>> exit()
到此,相信大家對“Python如何安裝mariadb對應的MySQLdb擴展”有了更深的了解,不妨來實際操作一番吧!這里是創(chuàng)新互聯(lián)網站,更多相關內容可以進入相關頻道進行查詢,關注我們,繼續(xù)學習!
網站欄目:Python如何安裝mariadb對應的MySQLdb擴展
鏈接分享:http://www.rwnh.cn/article8/gshcop.html
成都網站建設公司_創(chuàng)新互聯(lián),為您提供建站公司、標簽優(yōu)化、外貿網站建設、網站制作、網站收錄、品牌網站制作
聲明:本網站發(fā)布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創(chuàng)新互聯(lián)