{"id":2062,"date":"2023-04-01T21:34:24","date_gmt":"2023-04-01T13:34:24","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=2062"},"modified":"2023-04-07T06:04:30","modified_gmt":"2023-04-06T22:04:30","slug":"win64-install-mysql-python","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/04\/01\/win64-install-mysql-python\/","title":{"rendered":"Win64\u5b89\u88c5MySQL-python"},"content":{"rendered":"<p>\u5728Win64\u73af\u5883\u4e0b\u4f7f\u7528pip\u5b89\u88c5MySQL-python 1.2.5\uff0c\u62a5\u9519\uff1a<\/p>\n<pre><code class=\"language-shell\">> pip install MySQL-python\nCannot open include file: &#039;config-win.h&#039;: No such file or directory<\/code><\/pre>\n<p><!-- more --><\/p>\n<p>\u5b89\u88c5\u6b65\u9aa4\u5982\u4e0b\uff1a<\/p>\n<h3>\u5b89\u88c5 Microsoft Visual C++ Compiler Package for Python 2.7<\/h3>\n<p>\u4e0b\u8f7d\u6587\u4ef6\uff1aVCForPython27.msi<br \/>\n\u4e0b\u8f7d\u94fe\u63a5\uff1a<a target=\"_blank\" rel=\"noopener\" href=\"http:\/\/www.microsoft.com\/en-us\/download\/details.aspx?id=44266\">http:\/\/www.microsoft.com\/en-us\/download\/details.aspx?id=44266<\/a><\/p>\n<h3>\u5b89\u88c5 Mysql Connector\uff0c\u9009\u62e9\u5b89\u88c564\u4f4d\u7684<\/h3>\n<p>\u4e0b\u8f7d\u6587\u4ef6\uff1amysql-connector-c-6.0.2-winx64.msi<br \/>\n\u4e0b\u8f7d\u94fe\u63a5\uff1a<a target=\"_blank\" rel=\"noopener\" href=\"https:\/\/dev.mysql.com\/downloads\/connector\/c\/6.0.html\">https:\/\/dev.mysql.com\/downloads\/connector\/c\/6.0.html<\/a><\/p>\n<h3>\u4e0b\u8f7d MySQL-python 1.2.5 \u6e90\u7801\u5305\uff08\u4e00\u5b9a\u8981\u4f7f\u7528\u6e90\u7801\u5b89\u88c5\uff09<\/h3>\n<p>\u4e0b\u8f7d\u6587\u4ef6\uff1aMySQL-python-1.2.5.zip<br \/>\n\u4e0b\u8f7d\u94fe\u63a5\uff1a<a target=\"_blank\" rel=\"noopener\" href=\"https:\/\/pypi.python.org\/pypi\/MySQL-python\/1.2.5\">https:\/\/pypi.python.org\/pypi\/MySQL-python\/1.2.5<\/a><\/p>\n<p>\u89e3\u538b\u6e90\u7801\u5305\u540e\uff0c\u4fee\u6539 site.cfg \u6587\u4ef6<\/p>\n<blockquote>\n<p>\u5b9e\u9645\u4e0a\uff0c\u5982\u679c\u662f\u572832\u4f4d\u7cfb\u7edf\u4e0a\u90e8\u7f72\uff0c\u90a3\u4e48\u76f4\u63a5\u901a\u8fc7pip install \u5b89\u88c5MySQL-python 1.2.5 \u53ea\u9700\u8fdb\u884c\u4e0a\u9762\u7684\u4f9d\u8d56\u5305\u5b89\u88c5\u5373\u53ef\u3002<br \/>\n\u4f46\u5728 64 \u4f4d\u73af\u5883\u4e2d\uff0c\u5c31\u4f1a\u63d0\u793a <code>Cannot open include file: 'config-win.h'<\/code> \u9519\u8bef\u3002\u539f\u56e0\u5c31\u662f site.cfg \u4e2d\u914d\u7f6e\u7684 MySQL Connector C \u4e3a32 \u4f4d\u7248\u672c\u3002<\/p>\n<\/blockquote>\n<p>\u539f\u6765\u7684 site.cfg \u6587\u4ef6\u5185\u5bb9\u5982\u4e0b\uff1a<\/p>\n<pre><code># http:\/\/stackoverflow.com\/questions\/1972259\/mysql-python-install-problem-using-virtualenv-windows-pip\n# Windows connector libs for MySQL. You need a 32-bit connector for your 32-bit Python build.\nconnector = C:\\Program Files (x86)\\MySQL\\MySQL Connector C 6.0.2<\/code><\/pre>\n<p>\u4fee\u6539\u4e3a\uff1a<\/p>\n<pre><code>connector = C:\\Program Files\\MySQL\\MySQL Connector C 6.0.2<\/code><\/pre>\n<p>\u8fd0\u884c <code>python setup.py install<\/code> \u5373\u53ef\u5b89\u88c5\u5b8c\u6210\u3002<\/p>\n<h3>\u5b89\u88c5MySQL\u6570\u636e\u5e93\u9a71\u52a8<\/h3>\n<p>PyMySQL: <a target=\"_blank\" rel=\"noopener\" href=\"https:\/\/pypi.python.org\/pypi\/PyMySQL\">https:\/\/pypi.python.org\/pypi\/PyMySQL<\/a><\/p>\n<pre><code>> pip install PyMySQL<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u5728Win64\u73af\u5883\u4e0b\u4f7f\u7528pip\u5b89\u88c5MySQL-python 1.2.5\uff0c\u62a5\u9519\uff1a > pip install My [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[79],"tags":[],"class_list":["post-2062","post","type-post","status-publish","format-standard","hentry","category-python"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/2062","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=2062"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/2062\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=2062"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=2062"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=2062"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}