python
  • mysql
  • python-2.7
  • pip
  • 2014-06-08 56 views 3 likes 
    3

    我想從蟒蛇連接到MySQL數據庫Python不能安裝mysql庫

    我試着這樣做:pip install mysql-python因爲這個問題提出No module named MySQLdb

    ,但我得到這個例外

    Cleaning up... 
    Command C:\Python27\python.exe -c "import setuptools, tokenize;__file__='c:\\use 
    rs\\user\\appdata\\local\\temp\\pip_build_User\\mysql-python\\setup.py';exec(com 
    pile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __f 
    ile__, 'exec'))" install --record c:\users\user\appdata\local\temp\pip-kkagjy-re 
    cord\install-record.txt --single-version-externally-managed --compile failed wit 
    h error code 1 in c:\users\user\appdata\local\temp\pip_build_User\mysql-python 
    Storing debug log for failure in C:\Users\User\pip\pip.log 
    

    在我的python代碼中,我一直收到這個錯誤

    No module named MySQLdb 
    

    我使用Windows 7

    +0

    你需要一個C編譯器和工具鏈設置安裝此。你有沒有安裝c編譯器?您使用什麼操作系統?您可能想看看這篇博客文章:http://mysql-python.blogspot.ca/2012/11/is-mysqldb-hard-to-install.html – shuttle87

    +0

    @ shuttle87我正在使用Windows 7 –

    +0

    @ shuttle87博客你建議我必須有'vs2008'的統計數據,這是不可能的。我有'vs2012' –

    回答

    1

    我找到了解決自己

    http://www.codegood.com/archives/129

    下載軟件,而這已足夠

    +0

    如果你想要一個更新的資源庫,請看[http://www.lfd.uci.edu/~gohlke/pythonlibs/#mysql-python](http://www .lfd.uci.edu /〜gohlke/pythonlibs /#的MySQL-蟒)。 – Matthias

    相關問題