pip error: unrecognized command line option ‘-fstack-protector-strong’

后端 未结 3 825
挽巷
挽巷 2020-12-18 21:46

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

3条回答
  •  悲&欢浪女
    2020-12-18 22:28

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

    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).

    I can think of 3 ways to solve this issue:

    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) 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) Edit /usr/lib/python2.7/plat-x86_64-linux-gnu/_sysconfigdata_nd.py to reflect your updated compiler

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

    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 . . . 
    

    move things back to how they were

    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
    

提交回复
热议问题