python学习笔记1——安装python
centos和ubuntu的python2.7的安装方法参考:http://daixuan.blog.51cto.com/5426657/1767325
1、查看当前python版本并且
[root@localhost ~]# python -V Python 2.6.6
2、安装eple-release扩展源
[root@localhost ~]# yum install -y epel-release
3、安装pip
[root@localhost ~]#yum install python-pip
4、安装ipython(因为系统python版本是2.6.6,所以安装ipthon1.2.1与其兼容)
[root@localhost ~]# pip install ipython==1.2.1
源码安装,到网站上下载ipython-1.2.1.tar.gz
tar -zxvf ipython-1.2.1.tar.gz
cd ipython-1.2.1
python setup.py install
注:如果不指定版本,会到网站上下载最新版本:https://pypi.python.org/pypi/ipython
[root@localhost ~]# yum install -y python-pip //这样安装会有问题 [root@localhost ~]# pip install ipython //默认安装的是ipython-4.2.0,python2.6不能使用 [root@localhost ~]# ipython Traceback (most recent call last): File "/usr/bin/ipython", line 7, in <module> from IPython import start_ipython File "/usr/lib/python2.6/site-packages/IPython/__init__.py", line 34, in <module> raise ImportError(‘IPython requires Python version 2.7 or 3.3 or above.‘) ImportError: IPython requires Python version 2.7 or 3.3 or above.
4、测试ipython的自动补全功能
[root@localhost ~]# ipython Python 2.6.6 (r266:84292, Jul 23 2015, 15:22:56) Type "copyright", "credits" or "license" for more information. IPython 1.2.1 -- 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 [1]: print 2+4 6
本文出自 “梅花香自苦寒来!” 博客,请务必保留此出处http://daixuan.blog.51cto.com/5426657/1771895
原文地址:http://daixuan.blog.51cto.com/5426657/1771895