安装pymssql需要的包:
freetds(ftp://ftp.freetds.org/pub/freetds/stable/)
setuptools(https://pypi.python.org/pypi/setuptools)
pymssql(https://pypi.python.org/pypi/pymssql/)
安装步骤:
1. 安装freetds
$wget ftp://ftp.freetds.org/pub/freetds/stable/freetds-patched.tar.gz
#tar zxvf freetds-patched.tar.gz
#cd freetds-0.95.91
#./configure --prefix=/usr/local/freetds --with-tdsver=8.0 --enable-msdblib --enable-dbmfix --with-gnu-ld --enable-shared --enable-static
#make && make install
#echo "/usr/local/freetds/lib" >> /etc/ld.so.conf.d/freetds.conf
#ldconfig -v
2. 安装setuptools
$wget https://bootstrap.pypa.io/ez_setup.py -O - | sudo python
3.安装python-dev
#apt-get install python-dev
4. 安装pymssql
#pip install pymssql
注:如果不安装python-dev,会报如下错误:
error: command 'gcc' failed with exit status 1