安裝python時出現(xiàn)MySQLdb報錯如何解決-創(chuàng)新互聯(lián)

安裝python時出現(xiàn)MySQLdb報錯如何解決?針對這個問題,這篇文章詳細介紹了相對應(yīng)的分析和解答,希望可以幫助更多想解決這個問題的小伙伴找到更簡單易行的方法。

成都創(chuàng)新互聯(lián)技術(shù)團隊10年來致力于為客戶提供網(wǎng)站建設(shè)、網(wǎng)站設(shè)計、品牌網(wǎng)站制作成都全網(wǎng)營銷、搜索引擎SEO優(yōu)化等服務(wù)。經(jīng)過多年發(fā)展,公司擁有經(jīng)驗豐富的技術(shù)團隊,先后服務(wù)、推廣了1000+網(wǎng)站,包括各類中小企業(yè)、企事單位、高校等機構(gòu)單位。

問題描述:

windows安裝python mysqldb時報錯python version 2.7 required,which was not found in the registry

網(wǎng)上很多方案,比如方案一:

Python3.x時, from _winreg import *  改為 from winreg import * 去掉下劃線

import sys  
 from _winreg import *  
# tweak as necessary  
version = sys.version[:3]  
installpath = sys.prefix  
regpath = "SOFTWARE\\Python\\Pythoncore\\%s\\" % (version)  
installkey = "InstallPath"  
pythonkey = "PythonPath"  
pythonpath = "%s;%s\\Lib\\;%s\\DLLs\\" % (  
  installpath, installpath, installpath  
)  
def RegisterPy():  
  try:  
    reg = OpenKey(HKEY_CURRENT_USER, regpath)  
  except EnvironmentError as e:  
    try:  
      reg = CreateKey(HKEY_CURRENT_USER, regpath)  
      SetValue(reg, installkey, REG_SZ, installpath)  
      SetValue(reg, pythonkey, REG_SZ, pythonpath)  
      CloseKey(reg)  
    except:  
      print "*** Unable to register!"  
      return  
    print "--- Python", version, "is now registered!"  
    return  
  if (QueryValue(reg, installkey) == installpath and  
    QueryValue(reg, pythonkey) == pythonpath):  
    CloseKey(reg)  
    print "=== Python", version, "is already registered!"  
    return  
  CloseKey(reg)  
  print "*** Unable to register!"  
  print "*** You probably have another Python installation!"  
if __name__ == "__main__":  
  RegisterPy()

方案二:

這種也是我遇到的情況,是因為你的MySQLdb與python的版本不匹配,你要下載匹配的版本即可

關(guān)于安裝python時出現(xiàn)MySQLdb報錯如何解決問題的解答就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,如果你還有很多疑惑沒有解開,可以關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道了解更多相關(guān)知識。

文章名稱:安裝python時出現(xiàn)MySQLdb報錯如何解決-創(chuàng)新互聯(lián)
文章路徑:http://bm7419.com/article44/dpdcee.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站設(shè)計公司、全網(wǎng)營銷推廣、定制網(wǎng)站、響應(yīng)式網(wǎng)站做網(wǎng)站、網(wǎng)站內(nèi)鏈

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

網(wǎng)站優(yōu)化排名