我如何通过 apt-get 安装 python-dev?

我如何通过 apt-get 安装 python-dev?

我努力了

这些都没有安装 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.h中缺少 c 头文件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但无法安装。

尝试过这在启动板上但不起作用。

答案1

你确定你做得对吗?

这是我的输出# 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并确保多元宇宙和宇宙已启用(见我如何启用“Universe”存储库?)我还得到了向后移植在我的系统中启用,不确定在这种情况下是否有所不同。

答案2

尝试这个:

sudo apt-get install python3

而不是 python-dev,其中包“python3”包含 python3 和 python-dev

相关内容