gpt4 book ai didi

python - pip 错误 : unrecognized command line option ‘-fstack-protector-strong’

转载 作者:太空狗 更新时间:2023-10-29 17:24:27 25 4
gpt4 key购买 nike

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

x86_64-linux-gnu-gcc:错误:无法识别的命令行选项“-fstack-protector-strong”

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

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

我看过this , this , this , 和 this寻求帮助,但我还没有解决问题。

我已经安装了libxml2-dev、libxslt1-dev 和python-dev。我在 DigitalOcean Droplet 上运行 Debian 7.0 x64

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

谢谢

最佳答案

我在尝试将我的 pandas 版本升级到 0.15.2 时遇到了这个问题

如果你安装了 gcc-4.9,你的系统上可能仍然有一个旧版本的 gcc(在我的例子中是 gcc-4.7)。

我可以想到 3 种方法来解决这个问题:

a) 符号链接(symbolic link)/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

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

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

How to use MinGW's gcc compiler when installing Python package using Pip? https://docs.python.org/2/install/#distutils-configuration-files

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

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

关于python - pip 错误 : unrecognized command line option ‘-fstack-protector-strong’ ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27182042/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com