阿里云 CentOS7.4 安装 Python3.6的方法讲解
作者:翁志来个人博文 时间:2022-06-12 23:56:13
1、到python官网 https://www.python.org 查找最新的原码,我使用的,Python-3.6.3
2、mkdir /home/soft
创建软件管理目录、
3、cd /home/soft/
进入soft目录,因为我下一步是下载python的源码
4、wget https://www.python.org/ftp/python/3.6.3/Python-3.6.3.tgz
下载Python-3.6.3的源码到/home/soft/里,如果没有安装wget 请执行下面的命令,
yum -y install wget
安装wget
5、tar -xzvf Python-3.6.3.tgz -C /Python-3.6
解压到 /home/soft/Python-3.6
6、vim /home/soft/Python-3.6/Modules/Setup
安装ssl,如果要使用pip的话,最好安装ssl
#修改结果如下:
# Socket module helper for socket(2)
_socket socketmodule.c timemodule.c
# Socket module helper for SSL support; you must comment out the other
# socket line above, and possibly edit the SSL variable:
#SSL=/usr/local/ssl
_ssl _ssl.c \
-DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
-L$(SSL)/lib -lssl -lcrypto
7、./configure --prefix=/usr/local/
我们打算把python3.6安装到目录 /usr/local/
源码的安装一般由3个步骤组成:配置(configure)、编译(make)、安装(make install)
8、make
9、make install
ython3.6程序的执行文件:/usr/local/bin/python3.6
python3.6应用程序目录:/usr/local/lib/python3.6
pip3的执行文件:/usr/local/bin/pip3.6
pyenv3的执行文件:/usr/local/bin/pyenv-3.6
更改/usr/bin/python链接
# cd/usr/bin
# mv python python.backup
# ln -s /usr/local/bin/python3.6 /usr/bin/python
# ln -s /usr/local/bin/python3.6 /usr/bin/python3
更改yum脚本的python依赖
# cd /usr/bin
# ls yum*
yum yum-config-manager yum-debug-restore yum-groups-manager
yum-builddep yum-debug-dump yumdownloader
更改以上文件头为
#!/usr/bin/python 改为 #!/usr/bin/python2
修改gnome-tweak-tool配置文件
# vi /usr/bin/gnome-tweak-tool
#!/usr/bin/python 改为 #!/usr/bin/python2
修改urlgrabber配置文件
# vi /usr/libexec/urlgrabber-ext-down
#!/usr/bin/python 改为 #!/usr/bin/python2
来源:http://blog.csdn.net/wengzilai/article/details/78621407
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
Python爬虫小技巧之伪造随机的User-Agent
在DOS界面如何运行python的py文件
![](https://img.aspxhome.com/file/2023/7/70837_0s.png)
CSS hack:区分IE6,IE7,firefox
用VBS语言实现的网页计算器源代码
![](https://img.aspxhome.com/file/UploadPic/200712/26/20071226172731580s.jpg)
Python中模块的使用--binascii模块用法
MSSQL数据库排序规则如何更改
Python类的用法实例浅析
python开启摄像头以及深度学习实现目标检测方法
解读ASP.NET 5 & MVC6系列教程(17):MVC中的其他新特性
Python数据分析Pandas Dataframe排序操作
![](https://img.aspxhome.com/file/2023/4/95704_0s.webp)
Python 深入理解yield
asp利用xmlhttp抓取特定网页内容例子
python将天数转换为日期字符串的方法实例
![](https://img.aspxhome.com/file/2023/0/84080_0s.png)
python顺序的读取文件夹下名称有序的文件方法
解决Python 进程池Pool中一些坑
Python中的np.random.seed()随机数种子问题及解决方法
![](https://img.aspxhome.com/file/2023/8/92378_0s.jpg)
Asp Object 之:AddHeader
QQ聊天窗口链接提示效果代码
Pycharm cannot set up a python SDK问题的原因及解决方法
![](https://img.aspxhome.com/file/2023/0/100760_0s.jpg)