91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

django安裝mysql驅動

發布時間:2020-07-31 15:16:18 來源:網絡 閱讀:2391 作者:sharonaa 欄目:軟件技術

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,故先執行命令:

brew install mysql-connector-c 


然后再執行:

pip3 install mysqlclient

報如下錯誤:

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

這個地方有點疑惑:使用pip3命令后,最終調用的是python,而不是python3


查看mysqlclient的源代碼,發現根本原因還是因為沒找到mysql_config,明白過來需要安裝mysql,才能正常安裝mysqlclient


Installed /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/mysqlclient-1.3.10-py3.6-macosx-10.6-intel.egg

Processing dependencies for mysqlclient==1.3.10

Finished processing dependencies for mysqlclient==1.3.10


向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

安徽省| 开江县| 瑞安市| 博湖县| 武鸣县| 旬邑县| 望城县| 松滋市| 儋州市| 庐江县| 海阳市| 峨山| 荥经县| 分宜县| 永靖县| 靖安县| 新宾| 蛟河市| 平阴县| 名山县| 呼伦贝尔市| 固镇县| 西吉县| 桦川县| 平邑县| 濮阳市| 兖州市| 大关县| 双柏县| 马尔康县| 扎囊县| 喜德县| 三门峡市| 进贤县| 全椒县| 东台市| 巴里| 尚志市| 沙河市| 邵东县| 海原县|