“ImportError:没有模块名称多边形”,没有地方可以下载模块多边形

时间:2013-10-28 20:54:22

标签: python polygon

我正在尝试运行在python中创建的程序,我收到错误:

“ImportError:无模块名称多边形”

我使用的是ubuntu,python 2.7和EPD 7.3-1。

如何下​​载python的模块Polygon的包和C扩展名?

我试过了:

sudo apt-get install python-polygon
sudo apt-get install python-polygon2

没有任何事情发生。

我从autor的页面下载了zip文件:“Polygon2-2.0.6.rar”。之后,我将Polygon2-2.0.6.rar提取到Polygon2-2.0.6,然后我去那个文件夹 并运行python setup.py install

给我:

jose@jose-Satellite-L845:~/Descargas/Polygon2-2.0.6$ python setup.py install

Using NumPy extension!
running install
running build
running build_py
running build_ext
building 'Polygon.cPolygon' extension

x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DDEFAULT_STYLE=STYLE_LIST -DWITH_NUMPY=1 -Isrc -I/usr/lib/python2.7/dist-packages/numpy/core/include -I/usr/include/python2.7 -c src/gpc.c -o build/temp.linux-x86_64-2.7/src/gpc.o

src/gpc.c: In function ‘gpc_read_polygon’:
src/gpc.c:1037:9: warning: ignoring return value of ‘fscanf’, declared with attribute warn_unused_result [-Wunused-result]

fscanf(fp, "%d", &(p->num_contours)); ^

src/gpc.c:1044:11: warning: ignoring return value of ‘fscanf’, declared with attribute warn_unused_result [-Wunused-result]

 fscanf(fp, "%d", &(p->contour[c].num_vertices));
       ^

src/gpc.c:1047:13: warning: ignoring return value of ‘fscanf’, declared with attribute warn_unused_result [-Wunused-result]

   fscanf(fp, "%d", &(p->hole[c]));
         ^
src/gpc.c:1054:13: warning: ignoring return value of ‘fscanf’, declared with attribute warn_unused_result [-Wunused-result]

   fscanf(fp, "%lf %lf", &(p->contour[c].vertex[v].x),
         ^

src/gpc.c: In function ‘gpc_polygon_clip’:

src/gpc.c:1471:31: warning: ‘dy’ may be used uninitialized in this function [-Wmaybe-uninitialized]

   build_intersection_table(&it, aet, dy);
                           ^

src/gpc.c:1460:12: warning: ‘yt’ may be used uninitialized in this function [-Wmaybe-uninitialized]

     if (edge->top.y == yt)
        ^

src/gpc.c:1328:20: warning: ‘tr’ may be used uninitialized in this function [-Wmaybe-uninitialized]

     vclass= tr + (tl << 1) + (br << 2) + (bl << 3);
                ^

src/gpc.c:1133:34: warning: ‘tl’ may be used uninitialized in this function [-Wmaybe-uninitialized]

int vclass, bl, br, tl, tr; ^

src/gpc.c:1133:30: warning: ‘br’ may be used uninitialized in this function [-Wmaybe-uninitialized]

int vclass, bl, br, tl, tr; ^

src/gpc.c:1133:26: warning: ‘bl’ may be used uninitialized in this function [-Wmaybe-uninitialized]

int vclass, bl, br, tl, tr; ^

src/gpc.c:1330:12: warning: ‘contributing’ may be used uninitialized in this function [-Wmaybe-uninitialized]

     if (contributing)
        ^

src/gpc.c: In function ‘gpc_tristrip_clip’:

src/gpc.c:2131:31: warning: ‘dy’ may be used uninitialized in this function [-Wmaybe-uninitialized]

   build_intersection_table(&it, aet, dy);
                           ^

src/gpc.c:2120:12: warning: ‘yt’ may be used uninitialized in this function [-Wmaybe-uninitialized]

     if (edge->top.y == yt)
        ^

src/gpc.c:1981:20: warning: ‘tr’ may be used uninitialized in this function [-Wmaybe-uninitialized]

     vclass= tr + (tl << 1) + (br << 2) + (bl << 3);
                ^

src/gpc.c:1794:34: warning: ‘tl’ may be used uninitialized in this function [-Wmaybe-uninitialized]

int vclass, bl, br, tl, tr; ^

src/gpc.c:1794:30: warning: ‘br’ may be used uninitialized in this function [-Wmaybe-uninitialized]

int vclass, bl, br, tl, tr; ^

src/gpc.c:1794:26: warning: ‘bl’ may be used uninitialized in this function [-Wmaybe-uninitialized]

int vclass, bl, br, tl, tr; ^

src/gpc.c:1983:12: warning: ‘contributing’ may be used uninitialized in this function [-Wmaybe-uninitialized]

     if (contributing)
        ^

src/gpc.c:2062:16: warning: ‘cft’ may be used uninitialized in this function [-Wmaybe-uninitialized]

         if (cft == LED)
            ^

src/gpc.c:2064:26: warning: ‘cf’ may be used uninitialized in this function [-Wmaybe-uninitialized]

           if (cf->bot.y == yb)
                      ^

x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DDEFAULT_STYLE=STYLE_LIST -DWITH_NUMPY=1 -Isrc -I/usr/lib/python2.7/dist-packages/numpy/core/include -I/usr/include/python2.7 -c src/cPolygon.c -o build/temp.linux-x86_64-2.7/src/cPolygon.o

src/cPolygon.c:4:20: fatal error: Python.h: No existe el archivo o el directorio

    #include <Python.h>
                ^
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

请帮忙。 提前谢谢。

1 个答案:

答案 0 :(得分:1)

下载zip文件,解压缩文件,cd进入该文件夹,运行python setup.py buildpython setup.py install

编辑:根据你的回答,你需要安装python-dev。

命令是:sudo apt-get install python-dev