安装pymssql需要的包:
freetds(http://www.filewatcher.com/m/freetds-0.82.tar.gz.1596755-0.html)
setuptools(https://pypi.python.org/pypi/setuptools)
pymssql(https://pypi.python.org/pypi/pymssql/)
安装步骤:
- 安装freetds
1
2
3
4
5
6
tar zxvf freetds-0.82.tar.gz
cd freetds-0.82
./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
就用这个:
编辑/etc/ld.so.conf
加一行:/usr/local/freetds/lib
然后run: ldconfig
- 安装setuptools
1
2
3
tar zxvf setuptools-3.5.1.tar.gz
cd setuptools-3.5.1
python setup.py install
- 安装pymssql
1
2
3
tar zxvf pymssql-2.1.0.tar.gz
cd pymssql-2.1.0
python setup.py install
注:如果不安装freetds,会报如下错误:
error: command 'gcc' failed with exit status 1