thinkhk 发表于 2018-8-14 09:57:52

python-MySQLdb接口程序安装

  python pip安装
  下载文件wget https://bootstrap.pypa.io/get-pip.py --no-check-certificate执行安装
  python get-pip.py
  centos 7,python2.7 安装python-MySQLdb,因是最小化安装,安装过程中需要依赖其他的工具或包
  # pipinstall mysql-python
  报错:Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-Gme83P/mysql-python/
  通过yum 安装以下两个包;
  # yum install mysql-devel
  # yum installpython-devel
  再执行安装,出现以下报错,需要安装gcc编译工具,
  Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-U2yiQI/mysql-python/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-iogwbL-record/install-record.txt --single-version-externally-managed --compile"failed with error code 1 in /tmp/pip-build-U2yiQI/mysql-python/
  #yum install gcc
  安装pip需要先装setuptools
  https://pypi.python.org/pypi/setuptools
  # pip install mysql-python
  Collecting mysql-python
  Using cached MySQL-python-1.2.5.zip
  Installing collected packages: mysql-python
  Running setup.py install for mysql-python ... done
页: [1]
查看完整版本: python-MySQLdb接口程序安装