Python使用setup.py安装第三方库
以安装安装第三方库 pdb-clone 为例。
一、下载第三方库
下载后解压,文件如下:
- snippet.bash
[yz@test pdb-clone]$ ll -rw-rw-r-- 1 yz yz 416 Mar 31 2015 foobar.py drwxrwxr-x 5 yz yz 87 Jun 22 14:34 lib -rw-rw-r-- 1 yz yz 18113 Mar 31 2015 LICENSE -rw-rw-r-- 1 yz yz 229 Mar 31 2015 MANIFEST.in lrwxrwxrwx 1 yz yz 22 Jun 22 14:32 NEWS -> pdb-clone.wiki/News.md -rwxr-xr-x 1 yz yz 66 Mar 31 2015 pdb-attach -rwxr-xr-x 1 yz yz 206 Mar 31 2015 pdb-clone drwxrwxr-x 2 yz yz 36 Mar 31 2015 python_patches lrwxrwxrwx 1 yz yz 22 Jun 22 14:32 README -> pdb-clone.wiki/Home.md -rw-rw-r-- 1 yz yz 1722 Mar 31 2015 README.rst -rw-rw-r-- 1 yz yz 6339 Mar 31 2015 setup.py drwxrwxr-x 2 yz yz 89 Mar 31 2015 testsuite
二、安装
[yz@test pdb-clone]$ python setup.py build [yz@test pdb-clone]$ sudo python setup.py install
三、问题
build安装过程中出现以下错误:
- snippet.bash
[yz@test pdb-clone]$ python setup.py build Traceback (most recent call last): File "setup.py", line 12, in <module> from test import test_support as support # Python 2 File "/usr/lib64/python2.7/test/test_support.py", line 22, in <module> import _testcapi ImportError: No module named _testcapi
需要安装python-test:
- snippet.bash
[yz@test pdb-clone]$ sudo yum install python-test
四、参考
打赏作者以资鼓励: