日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

django安装mysql驱动_django安装mysql驱动

發(fā)布時間:2025/3/20 数据库 29 豆豆
生活随笔 收集整理的這篇文章主要介紹了 django安装mysql驱动_django安装mysql驱动 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

django目前支持三種mysql驅動來進行mysql的鏈接MySQLdb is a native driver that has been developed and supported for over

a decade by Andy Dustman.

mysqlclient is a fork of MySQLdb which notably supports Python 3 and

can be used as a drop-in replacement for MySQLdb. At the time of this writing,

this is the recommended choice for using MySQL with Django.

MySQL Connector/Python is a pure Python driver from Oracle that does not

require the MySQL client library or any Python modules outside the standard

library.

mysqldb 目前不支持python3+,推薦使用mysqlclient

嘗試了在pycharm上直接安裝mysqlclient,報以下錯誤:OSError: mysql_config not found

在git上查閱安裝步驟:

Prerequisites

You may need to install the Python and MySQL development headers and libraries like so:

sudo apt-get install python-dev libmysqlclient-dev?# Debian / Ubuntu

sudo yum install python-devel mysql-devel?# Red Hat / CentOS

On Windows, there are binary wheel you can install without MySQLConnector/C or MSVC.

Note on Python 3 : if you are using python3 then you need to install python3-dev using the following command :

sudo apt-get install python3-dev?# debian / Ubuntu

sudo yum install python3-devel?# Red Hat / CentOS

brew install mysql-connector-c?# macOS (Homebrew)

Install from PyPI

pip install mysqlclient

因為我在mac上,使用的python3,故先執(zhí)行命令:

brew install mysql-connector-c

然后再執(zhí)行:

pip3 install mysqlclient

報如下錯誤:

Command "python setup.py egg_info" failed with error code 1 in /private/tmp/pip-build-m9v70gan/mysqlclient/

奇怪的是,使用pip3命令后,最終調用的是python,而不是python3

原文:http://qixiafeng.blog.51cto.com/6745496/1954328

總結

以上是生活随笔為你收集整理的django安装mysql驱动_django安装mysql驱动的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內容還不錯,歡迎將生活随笔推薦給好友。