简介:

记录 CentOS 6.x Python 环境的安装步骤。

一、安装依赖包

shell > yum -y install epel-release
shell > yum -y install gcc gcc-c++ wget readline-devel zlib-devel openssl-devel sqlite-devel shell > python -V
Python 2.6.

一、安装 Python 2.7

shell > cd /usr/local/src; wget -c https://www.python.org/ftp/python/2.7.13/Python-2.7.13.tgz
shell > tar zxf Python-2.7..tgz
sehll > cd Python-2.7.
shell > ./configure && make && make install shell > python2 -V
Python 2.7.

二、安装 Python 3.5

shell > cd /usr/local/src; wget -c https://www.python.org/ftp/python/3.5.4/Python-3.5.4.tgz
shell > tar zxf Python-3.5..tgz
shell > cd Python-3.5.
shell > ./configure && make && make install shell > python3 -V
Python 3.5.

三、安装 Virtualenv

shell > pip3 install virtualenv

四、创建不同的 Python 环境

1、Python 2.x

shell > virtualenv --no-site-packages -p python2 py2.x
shell > source py2.x/bin/activate (py2.x) shell > python -V
Python 2.7. (py2.x) shell > pip install ipython (py2.x) shell > ipython
Python 2.7. (default, Aug , ::)
Type "copyright", "credits" or "license" for more information. IPython 5.4. -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details. In []: (py2.x) shell > deactivate
# 创建了一个 python2 的虚拟环境 名称为 py2.x,之后激活这个虚拟环境
# 可以看到默认的 python 版本已经不是原来的 2.6.6
# 使用 pip 安装 ipython 软件包
# ipython 调用的 python 版本也是 2.7.13
# 退出虚拟环境

2、Python 3.x

shell > virtualenv --no-site-packages -p python3 py3.x
shell > source py3.x/bin/activate (py3.x) shell > python -V
Python 3.5. (py3.x) shell > pip install ipython (py3.x) shell > ipython
Python 3.5. (default, Aug , ::)
Type 'copyright', 'credits' or 'license' for more information
IPython 6.1. -- An enhanced Interactive Python. Type '?' for help. In []: (py3.x) shell > deactivate

# End

最新文章

  1. Vue.js——基于$.ajax实现数据的跨域增删查改
  2. MS SQL 日常维护管理常用脚本(二)
  3. 函数的定义和声明以及this
  4. 实际利率 > 名义利率
  5. 九度OJ 1500 出操队形 -- 动态规划(最长上升子序列)
  6. codeforces edu round3
  7. (转)iOS Wow体验 - 第三章 - 用户体验的差异化策略
  8. C++ buffer缓冲区的秘密
  9. 学习SpringMVC中优秀的代码编写风格
  10. python 运用numpy库与matplotlib库绘制数据图
  11. Codeforces Round #539 (Div. 2) C Sasha and a Bit of Relax
  12. [Mac]secureCRT私钥转换为mac ssh私钥
  13. javascript打印1-100内的质数
  14. BOM 清除
  15. CentOS7 vsftpd 安装及配置
  16. 关于visual studio code在win10系统上安装后会报扩展宿主意外终止的解决方法
  17. Windows Server 2008远程桌面端口更改方法
  18. python内置函数详细介绍
  19. Spring小节
  20. linux下删除已经不用的配置文件

热门文章

  1. java 多线程之:sleep() 方法
  2. WinForm 窗体间参数传递
  3. bzoj 4539 [Hnoi2016]树——主席树+倍增
  4. SQL Server Reporting Service 报错:报表服务器无法解密用于访问报表服务器数据库中的敏感数据或加密数据的对称密钥,必须还原备份密钥或删除所有加密的内容。
  5. golang defer的使用
  6. Linux Home目录硬盘空间缩减
  7. Hadoop高级培训课程大纲-开发者版
  8. BASIC-23_蓝桥杯_芯片测试
  9. 原来zabbix监控进程与端口是如此的简单!
  10. Java-Runoob-高级教程-实例-数组:03. Java 实例 – 获取数组长度-*