1.本次使用的是一台全新的腾讯云主机,首先获取linux系统版本信息。
[root@VM_46_121_centos ~]# cat /etc/redhat-release
<本系统默认自带python2.7.5>
[root@VM_46_121_centos ~]# python
Python 2.7.5 (default, Sep 15 2016, 22:37:39)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
CentOS Linux release 7.2.1511 (Core)
2.因为后期要用到pip3,所以先安装openssl,openssl-devel。
[root@VM_46_121_centos ~]# yum -y install openssl openssl-devel
3.下载编译安装python3.5,记的先下载gcc-c++!
[root@VM_46_121_centos ~]# cd /usr/local/src/
[root@VM_46_121_centos src]# wget https://www.python.org/ftp/python/3.5.2/Python-3.5.2.tgz
[root@VM_46_121_centos src]# tar -zxvf Python-3.5.2.tgz
[root@VM_46_121_centos src]# cd Python-3.5.2/
[root@VM_46_121_centos Python-3.5.2]# ./configure && make all && make install
[root@VM_46_121_centos Python-3.5.2]# python3
Python 3.5.2 (default, Apr 21 2017, 16:32:19)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on linux
Type "help", "copyright", "credits" or "license" for more information.
4.如果你想升级python版本到python3.5的话,如下操作。
[root@VM_46_121_centos Python-3.5.2]# mv /usr/bin/python /usr/bin/python2.6
[root@VM_46_121_centos Python-3.5.2]# ln -s /usr/local/bin/python3.5 /usr/bin/python
别忘了vim /usr/bin/yum
解决升级python导致yum不可用的问题!
5.因为我喜欢玩ipython所以使用pip3安装了。
[root@VM_46_121_centos Python-3.5.2]# pip3 install ipython
6.现在python3.5环境是没有任何问题的!需要执行什么py脚本直接python3.5+脚本即可!
[root@VM_46_121_centos python]# python3.5 simple.py
Please input an domain:www.baidu.com
www.a.shifen.com.
61.135.169.125
61.135.169.121
7.我的需求就这么简单!
相关文章
- mac book pro macOS10.13.3安装qt、qt creator C++开发环境,qt5.11.1,并解决cmake构建:qt mac this file is not part of any project the code
- 为 Python Server Pages 和 Oracle 构建快速 Web 开发环境。
- Android NDK开发 Android Studio使用新的Gradle构建工具配置NDK环境(一)
- EasyARM-iMX283A的Linux 开发环境构建
- 如何开发Vite3插件构建Electron开发环境
- 如何开发Vite3插件构建Electron开发环境
- 快速构建C++项目工具Scons,结合Editplus搭建开发环境
- idea构建spark开发环境,并本地运行wordcount
- 玩转VSCode-完整构建VSCode开发调试环境
- Eclipse+Tomcat+Mysql构建J2EE开发环境(转载)