pip错误:无法识别的命令行选项'-fstack-protector-strong'

coo*_*ast 13 python lxml pip cython pyquery

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

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
Run Code Online (Sandbox Code Playgroud)

/root/.pip/pip.log中的完整日志位于:http://pastebin.com/5R4VZDu8

我已经看过这个,这个,这个,这个求助,但我还没能解决这个问题.

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

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

谢谢

mey*_*son 23

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

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

我可以想出解决这个问题的3种方法:

a)symlink/usr/bin/x86_64-linux-gnu-gcc到/usr/bin/x86_64-linux-gnu-gcc-4.9如果你想对这个使用更新替代方案更有条理,请参阅https:// askubuntu .COM /问题/ 26498 /选择-GCC-和-G-版本

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以反映更新的编译器

使用Pip安装Python包时如何使用MinGW的gcc编译器? 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 . . . 
Run Code Online (Sandbox Code Playgroud)

把事情还原到他们的样子

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
Run Code Online (Sandbox Code Playgroud)


归档时间:

查看次数:

27786 次

最近记录:

9 年,1 月 前