编译frr--python版本问题--Python-3.7.7

[root@localhost frr-stable-7.3]# make
true
make  all-am
make[1]: Entering directory `/root/frr/frr-stable-7.3'
  CLIPPY   bgpd/bgp_debug_clippy.c
/bin/sh: line 1: 61329 Segmentation fault      lib/clippy ./python/clidef.py -o bgpd/bgp_debug_clippy.c bgpd/bgp_debug.c
make[1]: *** [bgpd/bgp_debug_clippy.c] Error 139
make[1]: Leaving directory `/root/frr/frr-stable-7.3'
make: *** [all] Error 2
[root@localhost frr-stable-7.3]# make V=1
true
make  all-am
make[1]: Entering directory `/root/frr/frr-stable-7.3'
lib/clippy ./python/clidef.py -o bgpd/bgp_debug_clippy.c bgpd/bgp_debug.c
make[1]: *** [bgpd/bgp_debug_clippy.c] Segmentation fault
make[1]: Leaving directory `/root/frr/frr-stable-7.3'
make: *** [all] Error 2
[root@localhost frr-stable-7.3]# make V=2
true
make  all-am
make[1]: Entering directory `/root/frr/frr-stable-7.3'
lib/clippy ./python/clidef.py -o bgpd/bgp_debug_clippy.c bgpd/bgp_debug.c
make[1]: *** [bgpd/bgp_debug_clippy.c] Segmentation fault
make[1]: Leaving directory `/root/frr/frr-stable-7.3'
make: *** [all] Error 2
[root@localhost frr-stable-7.3]# 
[root@localhost frr-stable-7.3]# find ./ -name clippy
./python/clippy
./lib/clippy
[root@localhost frr-stable-7.3]# ls python/clidef.py 
python/clidef.py
[root@localhost frr-stable-7.3]# 
[root@localhost frr-stable-7.3]# lib/clippy ./python/clidef.py
Segmentation fault
[root@localhost frr-stable-7.3]# gdb lib/clippy ./python/clidef.py
GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-115.el7
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "aarch64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /root/frr/frr-stable-7.3/lib/clippy...done.
"/root/frr/frr-stable-7.3/./python/clidef.py" is not a core dump: File format not recognized
(gdb) r
Starting program: /root/frr/frr-stable-7.3/lib/clippy 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0x0000000000000000 in ?? ()
Missing separate debuginfos, use: debuginfo-install bzip2-libs-1.0.6-13.el7.aarch64 elfutils-libelf-0.176-2.el7.aarch64 elfutils-libs-0.176-2.el7.aarch64 json-c-0.11-4.el7_0.aarch64 libattr-2.4.46-13.el7.aarch64 libcap-2.22-10.el7.aarch64 libgcc-4.8.5-39.el7.aarch64 libgcrypt-1.5.3-14.el7.aarch64 libgpg-error-1.12-3.el7.aarch64 libselinux-2.5-14.1.el7.aarch64 lz4-1.7.5-2.el7.aarch64 pcre-8.32-17.el7.aarch64 systemd-libs-219-67.el7_7.4.aarch64 xz-libs-5.2.2-1.el7.aarch64
(gdb) bt
#0  0x0000000000000000 in ?? ()
#1  0x0000000000461784 in PyMem_RawMalloc (size=<optimized out>) at Objects/obmalloc.c:420
#2  _PyMem_RawStrdup (str=str@entry=0x5e2820 "UTF-8") at Objects/obmalloc.c:487
#3  0x0000000000500f24 in Py_SetStandardStreamEncoding (encoding=encoding@entry=0x5e2820 "UTF-8", 
    errors=errors@entry=0x0) at Python/pylifecycle.c:184
#4  0x0000000000420e58 in main (argc=1, argv=0xfffffffff598) at lib/clippy.c:52
(gdb) 

原来是机器上安装的
Python-3有问题

 重新安装python3
1、解压安装包

#tar –zxvf Python-3.7.7.tgz

2、安装依赖

# yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make libffi-devel xz-devel gdbm-devel

3、编译源码

#cd Python-3.7.7

#./configure --prefix=/usr/local/python3

#make

#make install

如果没有报错就可以认为安装成功。

5、建立软链接

#ln -s /usr/local/python3/bin/python3.7 /usr/bin/python3

#ln –s /usr/local/python3/bin/pip3.7 /usr/bin/pip3

6、验证

#python3

#pip3
卸载python3
      rpm -qa|grep python3|xargs rpm -ev --allmatches --nodeps       卸载pyhton3
      whereis python3 |xargs rm -frv           删除所有残余文件
      成功卸载!
      whereis   python       查看现有安装的python
pip 官网:https://pypi.org/project/pip/

你可以通过以下命令来判断是否已安装:

pip --version
如果你还未安装,则可以使用以下方法来安装:

$ curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py   # 下载安装脚本
$ sudo python get-pip.py    # 运行安装脚本
注意:用哪个版本的 Python 运行安装脚本,pip 就被关联到哪个版本,如果是 Python3 则执行以下命令:

$ sudo python3 get-pip.py    # 运行安装脚本。
python -m pip uninstall pip
 yum -y install  python3
 yum -y install  python3-pip

pip install virtualenv -i https://mirrors.aliyun.com/pypi/simple/

原文地址:https://www.cnblogs.com/dream397/p/12737910.html