在 ubuntu 18.04 上安装某些 python 模块时 cajarename 包出现错误

在 ubuntu 18.04 上安装某些 python 模块时 cajarename 包出现错误

我试图安装 python多边形Ubuntu 18.04 上的模块。我只需使用:-

pip install Polygon2

但后来我得到了如下错误:-

cajarename 17.3.28 requires caja, which is not installed.
cajarename 17.3.28 requires gir1.2-gtk-3.0, which is not installed.
cajarename 17.3.28 requires python-caja, which is not installed.
cajarename 17.3.28 requires python-gi, which is not installed.
jsonschema 2.6.0 requires functools32; python_version == "2.7", which is not installed.

所以我认为这与 cajarename 包或 ubuntu 发行版本身的一些错误有关。请帮忙找到解决办法。

完整错误如下:-

Collecting Polygon2
  Using cached https://files.pythonhosted.org/packages/73/9e/fe761e03de28b51b445ddf01ddae87441b7e7040df7d830b86db8f945808/Polygon2-2.0.8.tar.gz
cajarename 17.3.28 requires caja, which is not installed.
cajarename 17.3.28 requires gir1.2-gtk-3.0, which is not installed.
cajarename 17.3.28 requires python-caja, which is not installed.
cajarename 17.3.28 requires python-gi, which is not installed.
jsonschema 2.6.0 requires functools32; python_version == "2.7", which is not installed.
Installing collected packages: Polygon2
  Running setup.py install for Polygon2 ... error
    Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-9FYaXv/Polygon2/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-record-hQqeIk/install-record.txt --single-version-externally-managed --compile:
    Using NumPy extension!
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-2.7
    creating build/lib.linux-x86_64-2.7/Polygon
    copying Polygon/Utils.py -> build/lib.linux-x86_64-2.7/Polygon
    copying Polygon/Shapes.py -> build/lib.linux-x86_64-2.7/Polygon
    copying Polygon/__init__.py -> build/lib.linux-x86_64-2.7/Polygon
    copying Polygon/IO.py -> build/lib.linux-x86_64-2.7/Polygon
    running build_ext
    building 'Polygon.cPolygon' extension
    creating build/temp.linux-x86_64-2.7
    creating build/temp.linux-x86_64-2.7/src
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-nbjU53/python2.7-2.7.15~rc1=. -fstack-protector-strong -Wformat -Werror=format-security -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:3: warning: ignoring return value of ‘fscanf’, declared with attribute warn_unused_result [-Wunused-result]
       fscanf(fp, "%d", &(p->num_contours));
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    src/gpc.c:1044:5: 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:7: warning: ignoring return value of ‘fscanf’, declared with attribute warn_unused_result [-Wunused-result]
           fscanf(fp, "%d", &(p->hole[c]));
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    src/gpc.c:1054:7: warning: ignoring return value of ‘fscanf’, declared with attribute warn_unused_result [-Wunused-result]
           fscanf(fp, "%lf %lf", &(p->contour[c].vertex[v].x),
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                 &(p->contour[c].vertex[v].y));
                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    src/gpc.c: In function ‘gpc_polygon_clip’:
    src/gpc.c:1471:7: warning: ‘dy’ may be used uninitialized in this function [-Wmaybe-uninitialized]
           build_intersection_table(&it, aet, dy);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    src/gpc.c:1672:12: warning: ‘yt’ may be used uninitialized in this function [-Wmaybe-uninitialized]
             if ((edge->top.y == yt) && succ_edge)
                ^
    src/gpc.c:1133:38: warning: ‘tr’ may be used uninitialized in this function [-Wmaybe-uninitialized]
       int            vclass, bl, br, tl, tr;
                                          ^~
    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:1328:50: warning: ‘bl’ may be used uninitialized in this function [-Wmaybe-uninitialized]
             vclass= tr + (tl << 1) + (br << 2) + (bl << 3);
                                                  ~~~~^~~~~
    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:7: warning: ‘dy’ may be used uninitialized in this function [-Wmaybe-uninitialized]
           build_intersection_table(&it, aet, dy);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    src/gpc.c:2361:12: warning: ‘yt’ may be used uninitialized in this function [-Wmaybe-uninitialized]
             if ((edge->top.y == yt) && succ_edge)
                ^
    src/gpc.c:1794:38: warning: ‘tr’ may be used uninitialized in this function [-Wmaybe-uninitialized]
       int            vclass, bl, br, tl, tr;
                                          ^~
    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:1981:50: warning: ‘bl’ may be used uninitialized in this function [-Wmaybe-uninitialized]
             vclass= tr + (tl << 1) + (br << 2) + (bl << 3);
                                                  ~~~~^~~~~
    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 -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-nbjU53/python2.7-2.7.15~rc1=. -fstack-protector-strong -Wformat -Werror=format-security -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:10: fatal error: Python.h: No such file or directory
     #include <Python.h>
              ^~~~~~~~~~
    compilation terminated.
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

    ----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-9FYaXv/Polygon2/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-record-hQqeIk/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-9FYaXv/Polygon2/

答案1

我无法在干净的 Ubuntu 18.04 LTS 上重现您的问题。我已经安装了 pip 和 build-essential 以及 Python2 开发包:

sudo apt-get install python-pip build-essential libpython2.7-dev

您的警告是关于缺少已安装的 python 模块的依赖项。

这里有两个选择:

  • 安装上述依赖项

    sudo apt-get install caja gir1.2-gtk-3.0 python-caja python-gi
    
  • 删除损坏的 python 模块

    pip uninstall cajarename 
    pip uninstall jsonschema
    

相关内容