zoukankan      html  css  js  c++  java
  • CentOS 7安装Python 2.6(与已有版本共存)

    1. 安装需要用到的包

    yum install -y zlib-devel bzip2-devel openssl-devel xz-libs wget

    2. 下载 Python 2.6.8 版本

    wget https://www.python.org/ftp/python/2.6.8/Python-2.6.8.tgz

    3. 解压文件

    tar -xzvf Python-2.6.8.tgz -C /opt/software/

    4. 进入解压后文件的目录

    cd Python-2.6.8

    5. 配置安装信息.

    ./configure  --enable-shared --prefix=/opt/module/python2.6

    (添加参数:--enable-shared,这样即会生成libpython2.6.so.1.0)

    6. 编译文件

    make

    (若失败提示:configure: error: no acceptable C compiler found in $PATH

    安装GCC:yum install gcc)

    7. 安装编译好的文件

    make altinstall      # 使用 altinstall 安装, 不影响其他 Python 版本

    8. 设置软链接, 方便随时切换 Python 版本

    ln -s /opt/module/python2.6/bin/python2.6 /usr/bin/python2.6
    ln -s /opt/module/python2.6/lib/libpython2.6.so.1.0  /usr/lib/libpython2.6.so.1.0

    9.出现错误:python: error while loading shared libraries: libpython2.7.so.1.0: cannot open shared object file: No such file or directory

    原因:linux系统默认没有把lib路径加入动态库搜索路径 

    解决:

    [root@hadoop101 ~]# vim /etc/ld.so.conf
    # 添加如下一行内容
    /opt/module/python2.6/lib  #python2.6的路径
    [root@hadoop101 ~]# ldconfig  # 使新添加的路径生效
    [root@hadoop101 ~]# /sbin/ldconfig -v

    参考:https://blog.csdn.net/lyq19870515/article/details/80449386

  • 相关阅读:
    09 shell脚本程序练习
    springboot整合vue03-创建springboot工程
    springboot整合vue02-创建前端页面
    springboot整合vue01-创建vue工程
    pe工具04-获取数据目录
    pe工具03-获取节表信息
    pe工具02-解析pe头信息
    pe工具01-获取进程和模块
    以挂起方式创建进程
    进程
  • 原文地址:https://www.cnblogs.com/MWCloud/p/11354591.html
Copyright © 2011-2022 走看看