ralphdc

python2.7.9安装mysql-python模块

我使用的系统版本是: 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!

分类:

技术点:

相关文章:

  • 2021-12-03
  • 2021-12-22
  • 2021-09-17
  • 2022-12-23
  • 2021-12-02
  • 2021-09-17
  • 2021-06-09
  • 2022-12-23
猜你喜欢
  • 2021-12-13
  • 2021-11-14
  • 2021-11-02
  • 2022-02-22
  • 2021-09-29
  • 2021-12-02
  • 2021-09-17
相关资源
相似解决方案