pip错误:无法识别的命令行选项"-fstack-protector-strong" [英] pip error: unrecognized command line option ‘-fstack-protector-strong’

查看:166
本文介绍了pip错误:无法识别的命令行选项"-fstack-protector-strong"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我sudo pip install pyquerysudo pip install lxmlsudo pip install cython时,我得到非常相似的输出,但有相同的错误,指出:

When I sudo pip install pyquery, sudo pip install lxml, and sudo pip install cython, I get very similar output with the same error that says:

x86_64-linux-gnu-gcc: error: unrecognized command line option ‘-fstack-protector-strong’

这是sudo pip install pyquery的完整点输出:

Requirement already satisfied (use --upgrade to upgrade): pyquery in /usr/local/lib/python2.7/dist-packages
Downloading/unpacking lxml>=2.1 (from pyquery)
  Running setup.py egg_info for package lxml
    /usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'bugtrack_url'
      warnings.warn(msg)
    Building lxml version 3.4.1.
    Building without Cython.
    Using build configuration of libxslt 1.1.28

Requirement already satisfied (use --upgrade to upgrade): cssselect in /usr/local/lib/python2.7/dist-packages/cssselect-0.9.1-py2.7.egg (from pyquery)
Installing collected packages: lxml
  Running setup.py install for lxml
    /usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'bugtrack_url'
      warnings.warn(msg)
    Building lxml version 3.4.1.
    Building without Cython.
    Using build configuration of libxslt 1.1.28
    building 'lxml.etree' extension
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/libxml2 -I/root/build/lxml/src/lxml/includes -I/usr/include/python2.7 -c src/lxml/lxml.etree.c -o build/temp.linux-x86_64-2.7/src/lxml/lxml.etree.o -w
    x86_64-linux-gnu-gcc: error: unrecognized command line option ‘-fstack-protector-strong’
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
    Complete output from command /usr/bin/python -c "import setuptools;__file__='/root/build/lxml/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-gg4SuG-record/install-record.txt:
    /usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'bugtrack_url'

  warnings.warn(msg)

Building lxml version 3.4.1.

Building without Cython.

Using build configuration of libxslt 1.1.28

running install

running build

running build_py

copying src/lxml/includes/lxml-version.h -> build/lib.linux-x86_64-2.7/lxml/includes

running build_ext

building 'lxml.etree' extension

x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/libxml2 -I/root/build/lxml/src/lxml/includes -I/usr/include/python2.7 -c src/lxml/lxml.etree.c -o build/temp.linux-x86_64-2.7/src/lxml/lxml.etree.o -w

x86_64-linux-gnu-gcc: error: unrecognized command line option ‘-fstack-protector-strong’

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

----------------------------------------
Command /usr/bin/python -c "import setuptools;__file__='/root/build/lxml/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-gg4SuG-record/install-record.txt failed with error code 1 in /root/build/lxml
Storing complete log in /root/.pip/pip.log

/root/.pip/pip.log中的完整日志在此处: http://pastebin.com/5R4VZDu8

The complete log from /root/.pip/pip.log is here: http://pastebin.com/5R4VZDu8

我查看了

I've looked at this, this, this, and this for help, but I haven't been able to solve the issue yet.

我已经安装了 libxml2-dev,libxslt1-dev和python-dev .我正在DigitalOcean小滴上运行 Debian 7.0 x64 .

I've already installed libxml2-dev, libxslt1-dev, and python-dev. I'm running Debian 7.0 x64 on a DigitalOcean droplet.

我只是想安装pyquery.有人可以帮我吗?

I'm just trying to install pyquery. Can someone please help me out?

谢谢

推荐答案

当我尝试将熊猫版本升级到0.15.2时遇到了这个问题

I ran into this problem when I attempted to upgrade my pandas version to 0.15.2

如果您安装gcc-4.9,则您的系统上可能仍旧有gcc的旧版本(在我的情况下为gcc-4.7).

If you install gcc-4.9 you are likely to still have an older version of gcc on your system (gcc-4.7 in my case).

我可以想到3种解决此问题的方法:

I can think of 3 ways to solve this issue:

a)symlink/usr/bin/x86_64-linux-gnu-gcc到 /usr/bin/x86_64-linux-gnu-gcc-4.9 如果您想对此使用 update-alternatives 更有条理,请参阅 https://askubuntu.com/questions/26498/choose-gcc-and-g-version

a) symlink /usr/bin/x86_64-linux-gnu-gcc to /usr/bin/x86_64-linux-gnu-gcc-4.9 if you want to be more organized about this use update-alternatives, see https://askubuntu.com/questions/26498/choose-gcc-and-g-version

b)弄清楚如何手动指定使用哪个编译器pip并将其设置在某种.conf文件中-我尚未检查此文件的存放位置,也没有检查pip的CLI选项是否可以实现相同的功能.原则上,创建/编辑/usr/lib/pythonX.Y/distutils/distutils.cfg应该可以.当我尝试使用这种方法时遇到了问题.

b) figure out how to manually specify which compiler pip uses and set it in some sort of .conf file - I haven't examined where this file lives or if there are CLI options for pip that accomplish the equivalent. In principle, creating/editing a /usr/lib/pythonX.Y/distutils/distutils.cfg should do it. I ran into problems when I tried to use this approach.

c)编辑/usr/lib/python2.7/plat-x86_64-linux-gnu/_sysconfigdata_nd.py以反映更新的编译器

c) Edit /usr/lib/python2.7/plat-x86_64-linux-gnu/_sysconfigdata_nd.py to reflect your updated compiler

如何使用MinGW的gcc使用Pip安装Python程序包时使用编译器吗? https://docs.python.org/2/install/#distutils-configuration -文件

我采用了快速而肮脏的解决方案(a)来强制一切正常工作

I went with the quick and dirty solution (a) to force everything to work

root@localhost:/home/user1$ rm /usr/bin/x86_64-linux-gnu-gcc
root@localhost:/home/user1$ ln -s /usr/bin/gcc-4.9 /usr/bin/x86_64-linux-gnu-gcc
root@localhost:/home/user1$ pip install pandas --upgrade
. . .  pandas compiles with gcc-4.9 here . . . 

将事情恢复原状

root@localhost:/home/user1$ rm /usr/bin/x86_64-linux-gnu-gcc
root@localhost:/home/user1$ ln -s /usr/bin/gcc-4.7 /usr/bin/x86_64-linux-gnu-gcc

这篇关于pip错误:无法识别的命令行选项"-fstack-protector-strong"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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