如何从 apt-get 安装 python-dev?

x0x*_*x0x 13 package-management python apt 14.04

我试过这个这个这个这个

这些都没有安装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
Run Code Online (Sandbox Code Playgroud)

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

这是因为缺少Python.h包含在python-dev包中的 c 头文件。

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

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
Run Code Online (Sandbox Code Playgroud)

为了 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
Run Code Online (Sandbox Code Playgroud)

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

在启动板上也试过这个,但不起作用。

小智 21

你确定你做对了吗?

这是我的输出 # 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]
Run Code Online (Sandbox Code Playgroud)

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

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

  • @John:输入以下命令:`sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) 主宇宙受限多元宇宙"` (4认同)
  • +1 .. 我在尝试使用 python3.5 安装时遇到了类似的错误。安装 **python3.5-dev** 后,错误消失了 (2认同)