Как установить Pycosat в Ubuntu?

Я бегу pip install pycosat, но получаю:

Downloading/unpacking pycosat
  Downloading pycosat-0.6.1.tar.gz (59kB): 59kB downloaded
  Running setup.py (path:/tmp/pip_build_masi/pycosat/setup.py) egg_info for package pycosat

Installing collected packages: pycosat
  Running setup.py install for pycosat
    building 'pycosat' extension
    x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DPYCOSAT_VERSION="0.6.1" -I/usr/include/python2.7 -c pycosat.c -o build/temp.linux-x86_64-2.7/pycosat.o
    pycosat.c:9:20: 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
    Complete output from command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_masi/pycosat/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-40CYkM-record/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
copying test_pycosat.py -> build/lib.linux-x86_64-2.7
running build_ext
building 'pycosat' extension
creating build/temp.linux-x86_64-2.7
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DPYCOSAT_VERSION="0.6.1" -I/usr/include/python2.7 -c pycosat.c -o build/temp.linux-x86_64-2.7/pycosat.o
pycosat.c:9:20: 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
----------------------------------------
Cleaning up...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_masi/pycosat/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-40CYkM-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_masi/pycosat
Storing debug log for failure in /home/masi/.pip/pip.log

Я бегу sudo -H pip install pycosat, но получаю:

Collecting pycosat
  Using cached pycosat-0.6.1.tar.gz
Building wheels for collected packages: pycosat
  Running setup.py bdist_wheel for pycosat ... error
  Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-0CcATa/pycosat/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d /tmp/tmpa1EG1Fpip-wheel- --python-tag cp27:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-2.7
  copying test_pycosat.py -> build/lib.linux-x86_64-2.7
  running build_ext
  building 'pycosat' extension
  creating build/temp.linux-x86_64-2.7
  x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DPYCOSAT_VERSION="0.6.1" -I/usr/include/python2.7 -c pycosat.c -o build/temp.linux-x86_64-2.7/pycosat.o
  pycosat.c:9:20: 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

  ----------------------------------------
  Failed building wheel for pycosat
  Running setup.py clean for pycosat
Failed to build pycosat
Installing collected packages: pycosat
  Running setup.py install for pycosat ... error
    Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-0CcATa/pycosat/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-l6ZMSb-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-2.7
    copying test_pycosat.py -> build/lib.linux-x86_64-2.7
    running build_ext
    building 'pycosat' extension
    creating build/temp.linux-x86_64-2.7
    x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DPYCOSAT_VERSION="0.6.1" -I/usr/include/python2.7 -c pycosat.c -o build/temp.linux-x86_64-2.7/pycosat.o
    pycosat.c:9:20: 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-build-0CcATa/pycosat/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-l6ZMSb-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-0CcATa/pycosat/

Комментарии

Мне не нравится использовать sudo с pip. Но, вероятно, необходимо здесь. Я не понимаю, почему gcc ошибка там при компиляции.


Как установить Pycosat в Ubuntu?

2
задан 29 May 2016 в 01:39

1 ответ

От https://stackoverflow.com/a/32030746/486919, выполненный sudo apt-get install python-dev прежде, чем работать pip install pycosat.

5
ответ дан 29 May 2016 в 11:39

Другие вопросы по тегам:

Похожие вопросы: