码迷,mamicode.com
首页 > 编程语言 > 详细

Linux下原码安装 python-3.6.6

时间:2019-07-06 00:24:34      阅读:122      评论:0      收藏:0      [点我收藏+]

标签:cap   org   sha   编译   export   get   vim   file   pre   

Linux下原码安装 python-3.6.6
  • 下载

    # wget https://www.python.org/ftp/python/3.6.6/Python-3.6.6.tgz
  • 安装依赖包

    # yum -y install zlib-devel bzip2-devel openssl-devel sqlite-devel readline-devel gcc
  • 解压并进入到解压目录
# tar xvf Python-3.6.6.tgz
# cd Python-3.6.6/
  • 修改 Modules/Setup.dist

167 #readline readline.c -lreadline –ltermcap
210 #SSL=/usr/local/ssl
212 #_ssl _ssl.c \
214 # -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
216 # -L$(SSL)/lib -lssl –lcrypto
将以上几行的#号去掉

# sed -ri ‘s/^#readline/readline/‘ Modules/Setup.dist
# sed -ri ‘s/^#(SSL=)/\1/‘ Modules/Setup.dist
# sed -ri ‘s@^#(_ssl)@\1@‘ Modules/Setup.dist
# sed -ri ‘s@^#([ \t]*-DUSE)@\1@‘ Modules/Setup.dist
# sed -ri ‘s@^#([ \t]*-L\$\(SSL\))@\1@‘ Modules/Setup.dist
  • 编译安装

    # ./configure --enable-shared
    # make && make install
  • 查看是否安装成功

    # python3

    python3: error while loading shared libraries: libpython3.6m.so.1.0: cannot open shared object file: No such file or directory
    出现以上报错

  • 解决以上问题
# find /usr/local/lib/ -name "libpython3.6m.so.1.0"
/usr/local/lib/libpython3.6m.so.1.0
# vim /etc/profile.d/python3_lib.sh
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
# source /etc/profile
  • 再次检查安装是否成功
# python3
>>> exit()
# pip3 –V

Linux下原码安装 python-3.6.6

标签:cap   org   sha   编译   export   get   vim   file   pre   

原文地址:https://blog.51cto.com/13480443/2417591

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!