如何在apt-get上安装python-dev?


12

我曾尝试这个这个这个这个

这些都没有安装python-dev,我安装了amd64系统14.04并运行,当我尝试安装wagtail,django cms时,出现错误:

     pysass.c:4: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_root/
    libsass/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace
    ('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-ojWg1O-record/install-
    record.txt --single-version-externally-managed --compile failed with error code 1 in 
    /tmp/pip_build_root/libsass
    Storing debug log for failure in /home/payload/.pip/pip.log

如何解决此问题并安装软件包?

这是因为包中缺少Python.hc标头python-dev

当我尝试以上链接时,它说:

apt-get install python-dev

Package python-dev is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
  python

E: Package 'python-dev' has no installation candidate

对于 apt-get install python2.7-dev

Package python2.7-dev is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'python2.7-dev' has no installation candidate

我研究了debian档案,并找到了一个python 2.7.8-1无法安装的软件包。

在启动板上也尝试过此操作,但不起作用。

Answers:


20

您确定您做对了吗?

这是我的输出 # apt-get install python2.7-dev

root@olympus:/home/zeus# apt-get install python2.7-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  libexpat1-dev libpython2.7-dev
The following NEW packages will be installed:
  libexpat1-dev libpython2.7-dev python2.7-dev
0 upgraded, 3 newly installed, 0 to remove and 7 not upgraded.
Need to get 22.4 MB of archives.
After this operation, 35.0 MB of additional disk space will be used.
Do you want to continue? [Y/n]

尝试以root(su)身份执行此操作

另外,尝试运行# apt update并确保启用了Multiverse和Universe(请参阅如何启用“ Universe”存储库?)。我还在系统中启用了反向端口,不确定在这种情况下是否有所不同。


imgur.com/dI6n3Pq这是我的屏幕截图。如何启用多元宇宙和宇宙?
x0x

4
@John:键入以下命令:sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) main universe restricted multiverse"
Sylvain Pineau 2014年

2
+1 ..尝试使用python3.5安装时出现类似错误。安装python3.5-dev后,错误消失了
Saurav Kumar

我遇到了相同的#include <Python.h>错误,并对其进行了sudo apt-get install python-dev修复。这是python2.7。
尼克·克劳福德
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.