“error: command 'x86_64-linux-gnu-gcc' fai

2020-02-24 11:52发布

Environment: Linux Mint 17 Cinnamon.

This error is displayed:

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

when attempting the following in a virtualenv:

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

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

Installing Pillow error: Setup script exited with error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

Installing lxml in virtualenv via pip install error: command 'x86_64-linux-gnu-gcc' failed

Pillow installation error: command 'gcc' failed with exit status 1

fatal error: Python.h: No such file or directory

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

sudo apt-get install python2.7-dev

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

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

9条回答
Deceive 欺骗
2楼-- · 2020-02-24 12:38

For me the installation of lxml was failing on compilation. I followed the instructions for installation of lxml and reduced the compiler optimizations:

sudo CFLAGS="-O0"  pip install lxml

After doing this, the compile of lxml succeeded.

查看更多
女痞
3楼-- · 2020-02-24 12:41

Work for me :
Just install python2.7-dev first
sudo apt-get install python2.7-dev

查看更多
我想做一个坏孩纸
4楼-- · 2020-02-24 12:46

This can be a problem in the pip. To solve, try:

sudo apt-get remove python-pip

To install pip, securely download get-pip.py.

https://bootstrap.pypa.io/get-pip.py

sudo python get-pip.py

查看更多
登录 后发表回答