安装python3.5可能使用的依赖
1 |
yum install openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel |
到python官网找到下载路径, 用wget下载
1 |
wget https://www.python.org/ftp/python/3.5.3/Python-3.5.3.tgz |
解压tgz包
1 |
tar -zxvf Python-<span class="hljs-number">3.5</span><span class="hljs-number">.3</span><span class="hljs-preprocessor">.tgz</span> |
- 1
把python移到/usr/local下面
1 |
mv Python-<span class="hljs-number">3.5</span><span class="hljs-number">.3</span> /usr/<span class="hljs-keyword">local</span> |
- 1
删除旧版本的python依赖
1 |
ll /usr/bin <span class="hljs-string">| grep python</span> |
- 1
1 |
rm -rf /usr/bin/<span class="hljs-keyword">python</span> |
- 1
进入python目录
1 |
<span class="hljs-built_in">cd</span> /usr/local/Python-<span class="hljs-number">3.5</span>.<span class="hljs-number">3</span>/ |
- 1
配置
1 |
./configure |
- 1
编译 make
1 |
<span class="hljs-built_in">make</span> |
- 1
编译,安装
1 |
make <span class="hljs-keyword">install</span> |
- 1
删除旧的软链接,创建新的软链接到最新的python
1 2 3 4 5 |
rm <span class="hljs-attribute">-rf</span> /usr/bin/python ln <span class="hljs-attribute">-s</span> /usr/<span class="hljs-built_in">local</span>/bin/python3<span class="hljs-number">.5</span> /usr/bin/python python <span class="hljs-attribute">-V</span> |