如何在Ubuntu 12.04中为Python3安装库netifaces? [英] How to install the library netifaces for Python3 in Ubuntu 12.04?

查看:752
本文介绍了如何在Ubuntu 12.04中为Python3安装库netifaces?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I made a program in Python3 which uses the package netifaces, I installed it with pip3 in two computers which had Ubuntu 13.04 and Ubuntu 13.10. However, I need to install it in other computer which has Ubuntu 12.04, and here I cannot install pip3 (python3-pip) because it is not on the repositories.

我要做的是下一步:

sudo aptitude install python3-setuptools
sudo easy_install3 pip

然后我有了pip3.问题是当我尝试通过pip3安装 netifaces 时,出现下一个错误:

And then I had pip3 available. The problem is when I tried to install netifaces with pip3, which gives me next error:

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文件夹到它们的符号链接,但是没有用.

If I install netifaces with pip or aptitude or apt-get the program does not recognise the library, because its documents are installed in python2 folders. I even tried to do a symbolic link from python3 folders to them, but it did not work.

有什么想法吗?

推荐答案

已解决!

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

I had to install the package python3-dev too, then the installation of netifaces from pip3 did not give me an error and now I can use it.

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

So the whole process (in my case) was:

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

sudo pip3 install netifaces

这篇关于如何在Ubuntu 12.04中为Python3安装库netifaces?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆