web-dev-qa-db-fra.com

Comment installer Pycosat dans Ubuntu?

Je lance pip install pycosat mais je reçois:

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

Je lance Sudo -H pip install pycosat mais je reçois:

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/

Commentaires

Je n'aime pas utiliser Sudo avec pip. Mais probablement nécessaire ici. Je ne comprends pas pourquoi gcc erreur dans la compilation.


Comment pouvez-vous installer Pycosat dans Ubuntu?

Depuis https://stackoverflow.com/a/32030746/486919 , exécutez Sudo apt-get install python-dev avant d'exécuter _pip install pycosat.

5
edwinksl