python2.7.9安裝mysql-python模組

來源:互聯網
上載者:User

標籤:網站   指令碼   nat   mysq   inter   mina   director   mpi   sp2   

我使用的系統版本是: SLES12-sp2

使用python串連Mysql資料庫,需要安裝mysql-python模組;

1. 首先安裝pip:

從python官方網站下載get-pipe.py,執行這個指令碼,就可以自動安裝(或升級)

2.執行命令:

pip install mysql-python

報錯:

_mysql.c:29:20: fatal error: Python.h: No such file or directory
#include "Python.h"
^
compilation terminated.
error: command ‘gcc‘ failed with exit status 1

是因為沒有安裝python-devel這個軟體包;

SUSE ENTERPRISE 12 SP 2 系統內建python版本是2.7.9, 找到合適的對應版本破費周折,到網上了找了一天,都沒有結果;

最後在這個地址找到了:

https://ftp.internet.de/pub/linux/suse/sdk12sp2/suse/x86_64/

下載:python-devel-2.7.9-24.2.x86_64.rpm

裝上它,然後重新執行pip install mysql-python就OK!

python2.7.9安裝mysql-python模組

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.