python - 如何在 Ubuntu 12.04 中为 Python3 安装库 netifaces?

标签 python python-3.x ubuntu pip

我用 Python3 编写了一个程序,它使用了 netifaces 包,我用 pip3 在两台装有 Ubuntu 13.04 和 Ubuntu 13.10 的计算机上安装了它。但是,我需要将它安装在其他装有 Ubuntu 12.04 的计算机上,这里我无法安装 pip3 (python3-pip),因为它不在存储库中。

接下来我要做的是:

sudo aptitude install python3-setuptools
sudo easy_install3 pip

然后我有了可用的 pip3。问题是当我尝试使用 pip3 安装 netifaces 时,这给了我下一个错误:

error: command 'gcc' failed with exit status 1
Command /usr/bin/python3 -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/netifaces/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-gkaftl-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_root/netifaces
Storing debug log for failure in /home/anubia/.pip/pip.log

如果我使用 pip 或 aptitude 或 apt-get 安装 netifaces 程序无法识别该库,因为它的文档安装在 python2 文件夹中。我什至尝试做一个从 python3 文件夹到它们的符号链接(symbolic link),但它没有用。

有什么想法吗?

最佳答案

解决了!

我也必须安装软件包 python3-dev,然后从 pip3 安装 netifaces 没有给我一个错误,现在我可以使用它了。

所以整个过程(就我而言)是:

sudo aptitude install python3-setuptools
sudo easy_install3 pip
sudo aptitude install python3-dev

sudo pip3 install netifaces

关于python - 如何在 Ubuntu 12.04 中为 Python3 安装库 netifaces?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24797412/

相关文章:

python - 将解析后的 csv 文件自动读取为字符串转换为 pandas 数据框

python - Pandas Resample 上采样数据的最后日期/边缘

python-3.x - 如何使用多个列值对 pandas 数据框进行数据透视表/数据透视表

在 C 中使用 TCP/IP 连接、读取、写入设备

python - MVC 框架从一种语言到另一种语言(例如 ASP.NET、Python、RoR 等)差异很大吗?

python - 使用 kwargs 的 Django 成功 url

c++ - 如何在我的系统中使用 OpenCL

linux - 使用 curl linux 在 easyupload.io 上上传文件

python - 如何在另一个子进程完成时终止正在运行的子进程(在多处理中)

python - 如果任务失败,如何调用 "task"?