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

歡迎訪問 生活随笔!

生活随笔

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

数据库

python3连接oracle数据库真操蛋_为64位Windows7的Python3安装MySQLdb

發布時間:2023/12/3 数据库 32 豆豆
生活随笔 收集整理的這篇文章主要介紹了 python3连接oracle数据库真操蛋_为64位Windows7的Python3安装MySQLdb 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

Install 64-bit MySQLdb for Python 3 on Windows 7

為64位Windows7的Pyhton3安裝MySQLdb

原文在此

Jesus Rollerblading Christ. It all started as a simple idea: I would install Django and start working on this web app idea I had and use it as a chance to learn more about Python and Django. I also decided to go with MySQL as the database for it since I already have a MySQL server installed on my home computer from previous projects. Little did I know that since I had chosen to go with Python 3, I was in for several evenings of pain and agony dealing with MySQLdb. After an emotional rollercoaster of build path fuckery that made me want to claw my eyes out, I finally got it working: I can use MySQLdb for Python 3.2 on Windows 7 64-bit. Here’s my tale in case you find yourself in the same situation and begin to ask yourself, “Why the fuck do people put up with this?”

基督尼瑪個耶穌.這一切始于一個簡單的想法:我想裝Django然后寫個網站,并用這個機會多學點Python和Djiango的知識.我理所當然的選MySQL當數據庫,因為在我家里的那臺電腦上裝著之前的一個項目里用到的MySQL服務.我從沒想到因為選擇Python3,讓我接下來的幾個夜晚都因為處理MySQLdb的問題而過的痛苦.之后的沒用的構建路徑讓我情緒很不穩定,都想抓出自己的眼睛.最后總算是搞定了:我可以在windows 7 64位的Python3中使用MySQLdb了.這就是我的故事,免得你和我踏進同意個坑然后抬頭問蒼天:"真的有人能搞定這種操蛋事?"

The Setup

安裝

Like I said, this is all because I was stupid enough to try to install Django 1.5 on Windows 7 using 64-bit Python 3.2 against a MySQL database server. FUCKIN’ N00B, HOW DARE YOU!

就像我剛剛說的,這一切都是因為我特傻叉想在windows 7 64位下,Python 3.2中安裝Django 1.5 然后使用MySQL數據庫.你也想這么干?真有膽子啊小菜鳥.

The first warning should’ve been that in Django’s docs they explicitly mention that the latest release of MySQLdb doesn’t support Python 3. “No problem”, I thought, “I’ve made a living off of dealing with software build bullshit, I can handle this.”

第一個警告來自Django官方文檔,明確提及最新版的MySQLdb不支持Python 3.(譯注:本文發表于2013年6月,直到2016年的今天MySQLdb依然不支持Py3),"沒問題",我想,"我就算干這行的,我能搞定"

Getting Started

準備開始

So I had to download a few things to get going:

所以我必須得下幾個東西來搞定這事

1.First I double checked the version of the MySQL server on my computer (which I had installed via Zend Server some time ago). It’s 5.1.43, so then I went hunting on MySQL’s website for a full binary + headers + libs package and found it on http://downloads.mysql.com/ar... So I downloaded the 64-bit zip (I figured since I have 64-bit Python, but it probably didn’t matter). Then I just unpacked that zip to my C:\

1.首先我檢查了我電腦上的MySQL版本(通過Zend Server裝的MySQL已經有一段時間了),是5.1.43,我去MySQL官網上找二進制包和鏈接庫,找到了這個 http://downloads.mysql.com/ar...譯注,新鏈接應該是http://dev.mysql.com/download...所以我下載了[這個]3(我想因為我用的是64位python,但是那并不重要),把它解壓到C盤

2.Next I downloaded the MySQL-for-Python-3 package the good Django folks suggested in their docs and unpacked that to a separate folder on C:\

2.接下來,下載MySQL-for-Python-3,Django官方建議的包,解壓到C盤的另一個文件夾

3.Also, I already have Visual Studio 2012 installed, so I had all the C compilers and shit at my disposal. Yay.

3.我已經安裝了VS2012,C編譯器的問題就搞定了.Yay.

The Blood and Guts

血雨腥風

After much trial and error and googling. This is what I came up with to make it work:

在不斷的GOOGLE和試驗后,下面是我總結出來的方法:

1.Open up a cmd prompt

1.打開CMD

2.Since I have Visual Studio 2012 I had to trick their (not sure if it’s Python’s or MySQLdb’s) stupid build process by pointing them to my Visual Studio 2012 toolset: SET VS90COMNTOOLS=%VS110COMNTOOLS%

2.因為我裝的是VS2012 ,所以我不得不偽造編譯路徑到我的VS2012命令行SET VS90COMNTOOLS=%VS110COMNTOOLS%

3.Then I cd’ed into the MySQL-for-Python-3 directory I unpacked earlier and edited the site.cfg (not in notepad..) file to change the mysql_location to point to the directory I unpacked the MySQL binary+header+libs package to earlier (e.g. mysql_location = C:mysql-5.1.43-winx64)

3.然后cd進入之前解壓的MySQL-for-Python-3的文件夾,編輯site.cfg(不要在記事本中編輯..)文件,更改mysql_location指向之前解壓的MySQL二進制包和鏈接庫的文件夾(例如:mysql_location = C:mysql-5.1.43-winx64)

4.Next, I had to edit the _mysql.c file (again, not in notepad) in MySQL-for-Python-3 to change line 35 from my_config.h to config-win.h

4.接下來,編輯_mysql.c文件(同理,不要在記事本中編輯),把35行的my_config.h改成config-win.h

5.Then, I edited my Python distribution’s C:Python32Libdistutilsmsvc9compiler.py to add a line after line 638 (ld_args.append(‘/MANIFESTFILE:’ + temp_manifest)) as: ld_args.append(‘/MANIFEST’). Why? Cause this dude said so, and it worked.

5.繼續,編輯Python3目錄下Libdistutilsmsvc9compiler.py文件,在638行(譯注:在python3.5中是673行,具體視情況而定)后面增加如下內容(ld_args.append(‘/MANIFESTFILE:’ + temp_manifest))

6.Oh yeah, and I had to edit the MySQL-for-Python-3 file setup_windows.py to change ‘lib’ to ‘lib/opt’ on line 17’s setting of library_dirs cause otherwise it couldn’t find the goddamn MySQL libs.

6.最后,編輯 MySQL-for-Python-3里的setup_windows.py文件,把17行處(位置依然視情況而定)library_dirs里的lib改成lib/opt,因為其他地方找不到該死的MySQL鏈接庫

And then FINALLY I was able to build and install the thing:

最后做的就是編譯和安裝的工作了:

C:MySQL-for-Python-3-master>python setup.py build

running build

running build_py

copying MySQLdbrelease.py -> buildlib.win-amd64-3.2MySQLdb

running build_ext

C:MySQL-for-Python-3-master>python setup.py install

And it fucking worked!

終于他喵的能用了!

So yeah, I’m sure some enlightened Python god will tell me I brought this pain upon myself given my version choices (and please tell me how stupid I am for using Windows), but it’s crap like this that makes me want to run screaming and crying back into Visual Studio/C#’s warm embrace, or at least PHP’s bony grasp…

好吧,我知道一些牛逼的Python大神會告訴我你這是自作自受,選這種版本來搞(還請告訴我這笨蛋到底要怎么用Windows),但那些都是讓我哭著回到Visual Studio/C#的溫暖懷抱或者讓我去學PHP皮毛的廢話罷了

Anyway, if you’re running into similar issues trying to force MySQLdb’s square peg into Python 3’s round hole, I hope this helps.

總之,如果你遇到類似的在python3用MySQLdb問題,我希望這個可以幫到你

總結

以上是生活随笔為你收集整理的python3连接oracle数据库真操蛋_为64位Windows7的Python3安装MySQLdb的全部內容,希望文章能夠幫你解決所遇到的問題。

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

主站蜘蛛池模板: 欧美激情精品久久久久久免费 | 综合五月激情 | 中文字幕在线播放一区 | 99热热热热 | 性大片潘金莲裸体 | 婷婷丁香久久 | 99精品视频在线看 | 亚洲一区中文 | 草久久久久| 制服丝袜快播 | 日本一区二区三区成人 | 成人在线观看网址 | 色www国产亚洲阿娇 自拍一区在线 | 麻豆专区| 影音先锋色小姐 | 蜜桃臀aⅴ精品一区二区三区 | 奇米狠狠777 | 嫩草精品| 亚洲九九九九 | 亚洲AV无码一区二区三区蜜桃 | 青草一区 | 伊人av网站 | 超碰97人| 51免费看成人啪啪片 | 麻豆影音先锋 | 亚洲欧洲一区二区 | 九九精品在线观看视频 | 91精品人妻一区二区三区果冻 | 国模精品视频一区二区 | yy4138理论片动漫理论片 | 国产一区二区三区在线看 | 在线观看亚洲一区二区 | 久久亚洲精精品中文字幕早川悠里 | 亚洲午夜剧场 | 欧美性受xxx黑人xyx性爽 | 欧美一级片播放 | 久热精品在线观看 | 韩国黄色大片 | 伊人狼人久久 | 日韩欧美三区 | 亚洲成人网在线播放 | 69精品人人人人 | 麻豆传媒一区二区三区 | 五月激情在线观看 | 欧美乱轮视频 | 天天干天天操天天 | 国产亚洲欧美日韩精品一区二区三区 | 久久er99热精品一区二区 | 视频二区在线观看 | 清纯唯美亚洲综合 | 韩国短剧在线观看 | 中国白嫩丰满人妻videos | 不卡日本视频 | 超碰98在线观看 | 中文字幕22页 | 亚洲第一页色 | 久久在线中文字幕 | 日韩精品欧美在线 | 欧美激情免费在线观看 | 欧美特级黄色录像 | 亚洲精选久久 | 欧美sm视频 | 91区| 一区二区三区 日韩 | 91亚洲国产成人久久精品网站 | 亚洲国产一区二区三区a毛片 | 成人午夜精品福利 | 五月色丁香 | 无码人妻丰满熟妇区毛片18 | 亚洲天堂自拍 | 日韩大片免费 | 久久精品一区二区三 | 催眠调教后宫乱淫校园 | 黄色一级免费看 | 亚洲免费影院 | 欧美日韩一区二区三区不卡视频 | 欧美在线一级 | 国产性色视频 | 欧美精品福利视频 | 性av网| 久久这里只有精品久久 | 日韩精品人妻无码一本 | 亚洲一区二区激情 | 午夜精品无码一区二区三区 | 精品国产一区二区三区噜噜噜 | tube极品少妇videos | 91亚洲国产成人精品一区二区三 | 亚洲人成无码网站久久99热国产 | 狠狠操av| 人妻 校园 激情 另类 | 女的高潮流时喷水图片大全 | 色综合福利 | 91久色视频 | 无码gogo大胆啪啪艺术 | 精品人妻av一区二区 | 亚洲一区毛片 | 日韩在线视频免费 | 翔田千里一区二区三区av | 性做久久|