“错误:命令'x86_64-linux-gnu-gcc'失败,退出状态为1"在virtualenv中

“错误:命令'x86_64-linux-gnu-gcc'失败,退出状态为1

问题描述:

环境:Linux Mint 17肉桂.

Environment: Linux Mint 17 Cinnamon.

显示此错误:

error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

virtualenv中尝试以下操作时:

pip install lxml
pip install pillow
pip install pycrypto
pip install pymongo (fails but still shows in pip freeze)

这里有几种建议安装python2.7-dev的解决方案:

There are several solutions here that recommend installing python2.7-dev:

安装枕头错误:安装脚本退出并出现错误:命令"x86_64-linux-gnu-gcc"失败,退出状态为1

安装通过pip安装错误在virtualenv中使用lxml:命令'x86_64-linux-gnu-gcc'失败

枕头安装错误:命令'gcc'失败退出状态为1

致命错误:Python.h:无此类文件或目录

但是我对这项建议感到困惑,因为据我了解,我使用了类似的东西:

I am confused by this recommendation however because it is my understanding that using something like:

sudo apt-get install python2.7-dev

会将其添加到Python的主要* system *实例中,而不是添加到virtualenv中的那个实例中. (请参阅- https://unix.stackexchange.com/a/56392/92486 )

would add this to the main *system* instance of Python, rather that the one in virtualenv. (see - https://unix.stackexchange.com/a/56392/92486)

我可以仅将python2.7-dev添加到Python的virtualenv版本中吗?

Can I add python2.7-dev just to the virtualenv version of Python?

我通过Linux Mint 17中的Synaptic软件包管理器安装了python2.7-dev.

I installed python2.7-dev via Synaptic Package Manager in Linux Mint 17.

然后我可以在virtualenv中完成以下操作:

I could then accomplish the following in virtualenv:

pip install pillow
pip install pycrypto

然后我通过Synaptic安装了libxml2-devlibxslt1-dev,可以完成以下任务:

And then I installed libxml2-dev and libxslt1-dev via Synaptic and could accomplish the following:

pip install lxml

我也这样做是为了使pymongo安装没有任何错误:

I also did this so that the pymongo install didn't have any errors:

pip uninstall pymongo
pip install pymongo  # i defined the version i needed ie pip install pymongo==2.6.2

我仍然很困惑如何解决此问题,因为我认为virtualenv是一个孤立的环境.任何对此的澄清表示赞赏.

I'm still confused how this fixes the problem, because I thought virtualenv was an isolated environment. Any clarification about this appreciated.