linux下python的安装
[root@centOS64A67 ~]# uname -r //查看内核版本
2.6.32-573.el6.x86_64 //我的CentOs6.7呵呵
[root@centOS64A67 ~]# rpm -q python //查看安装的python的rpm包
python-2.6.6-64.el6.x86_64
[root@centOS64A67 ~]# python -V //python版本
Python 2.6.6
[root@centOS64A67 ~]# python //进入python
Python 2.6.6 (r266:84292, Jul 23 2015,15:22:56)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-11)] onlinux2
Type "help","copyright", "credits" or "license" for moreinformation.
>>> print ‘hello world‘ //学过编程的童鞋们是不是对这两个单词和熟悉
hello world
>>> exit() // 退出
ipython 的安装 ,据说有补齐功能,so。。。。
要安装ipython先要用pip install ipython ,那pip这个软件包在哪里呢
1. 我们使用yum安装rpm包时,经常遇到一些包没有,这时候你可以尝试安装epel的扩展源,这里有很多系统不自带的rpm包。
[root@localhost~]# yum install -y epel-release
[root@localhost~]# yum list
你会发现最右侧出现很多epel的rpm包。同时会产生两个文件
[root@centOS64A67yum.repos.d]# ll
总用量 32
-rw-r--r--. 1 root root 1991 8月 4 2015 CentOS-Base.repo
-rw-r--r--. 1 root root 647 8月 4 2015 CentOS-Debuginfo.repo
-rw-r--r--. 1 root root 289 8月 4 2015 CentOS-fasttrack.repo
-rw-r--r--. 1 root root 630 8月 4 2015 CentOS-Media.repo
-rw-r--r--. 1 root root 6259 8月 4 2015 CentOS-Vault.repo
-rw-r--r-- 1 root root 957 11月 5 2012 epel.repo
-rw-r--r-- 1 root root 1056 11月 5 2012epel-testing.repo
[root@centOS64A67 yum.repos.d]# pip installipython
Successfullyinstalled backports.shutil-get-terminal-size-1.0.0 decorator-4.0.9ipython-4.2.0 ipython-genutils-0.1.0
pathlib2-2.1.0 pexpect-4.0.1pickleshare-0.7.2 ptyprocess-0.5.1 setuptools-21.0.0 simplegeneric-0.8.1 six-1.10.0 traitlets-4.2.1
//貌似安装成功?
[root@centOS64A67 yum.repos.d]# pip list //有个ipython4.2.0
You are using pip version 7.1.0, howeverversion 8.1.1 is available.
You should consider upgrading via the ‘pipinstall --upgrade pip‘ command.
argparse (1.2.1)
backports.shutil-get-terminal-size (1.0.0)
decorator (4.0.9)
distribute (0.6.10)
ethtool (0.6)
iniparse (0.3.1)
ipython (4.2.0)
ipython-genutils (0.1.0)
iwlib (1.0)
ordereddict (1.2)
pathlib2 (2.1.0)
pexpect (4.0.1)
pickleshare (0.7.2)
pip (7.1.0)
ptyprocess (0.5.1)
pycurl (7.19.0)
pygpgme (0.1)
python-dmidecode (3.10.13)
pyxdg (0.18)
setuptools (21.0.0)
simplegeneric (0.8.1)
six (1.10.0)
traitlets (4.2.1)
urlgrabber (3.9.1)
yum-metadata-parser (1.1.2)
[root@centOS64A67 yum.repos.d]# 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 orabove.‘)
ImportError: IPython requires Pythonversion 2.7 or 3.3 or above.
[root@centOS64A67 ~]# pip installipython==1.2.1 //指定要求的版
ReadTimeoutError: HTTPSConnectionPool(host=‘pypi.python.org‘,port=443): Read timed out.//这破网,唉
[root@centOS64A67 ~]# pip installipython==1.2.1 //继续
Downloading ipython-1.2.1.tar.gz (8.7MB)
100% |████████████████████████████████| 8.7MB 17kB/s
Installing collected packages: ipython
Found existing installation: ipython 4.2.0
Uninstalling ipython-4.2.0:
Successfully uninstalled ipython-4.2.0
Running setup.py install for ipython
Successfully installedipython-1.2.1 //最爱看Successfully installed
[root@centOS64A67~]# ipython
Python2.6.6 (r266:84292, Jul 23 2015, 15:22:56)
Type"copyright", "credits" or "license" for moreinformation.
IPython1.2.1 -- An enhanced Interactive Python.
? -> Introduction and overview ofIPython‘s features.
%quickref-> Quick reference.
help -> Python‘s own help system.
object? -> Details about ‘object‘, use ‘object??‘for extra details.
In[1]: pr
%%prun %precision %profile %prun print property //果然,呵呵
In[1]: print ‘hello world‘
helloworld
本文出自 “Linux” 博客,请务必保留此出处http://xiraowangja.blog.51cto.com/3952075/1771602
原文地址:http://xiraowangja.blog.51cto.com/3952075/1771602