linux下ipython的安裝

第一種:ipython源碼安裝
ipython的源碼下載頁面爲:https://pypi.python.org/pypi/ipythonpython

或者是到git頁面下載:https://github.com/ipython/ipython/downloads
假設咱們下載的文件名爲:ipython-0.8.2.tar.gzlinux

?
1
2
#tar zvxf ipython-0.8.2.tar.gz  //解壓文件
#cd ipython-0.8.2 //進入剛剛解壓的文件夾內

進入文件加後會看到一個setup.py的安裝腳本,運行如下命令進行安裝git

?
1
#python setup.py install

操做將會在site-packages目錄中安裝ipyhon的庫文件,並在scripts目錄中建立一個ipython腳本。在unix系統中,該目錄與python的二進制文件目錄相同。若是系統中已經安裝了python包,則ipython將會安裝在/usr/bin目錄下。github

 

安裝完成後,運行ipython會報錯,緣由是不少模塊沒有安裝,固然用pip安裝ipython確定方便,可是,在沒有網絡的狀況下,只能每次都下載模塊,而後再進行編譯安裝了。bash

2.1 下載IPython

[root@bogon ~]# wget https://pypi.python.org/packages/09/2e/870d1058768f5240062beb0bd2ff789ac689923501b0dd6b480fb83314fc/ipython-5.0.0.tar.gz#md5=9c00df2f7e2e2636aba02671f45eea6b

注意:最新的IPython能夠從這裏獲取:https://pypi.python.org/pypi/ipython網絡

2.2 解壓IPython

[root@bogon ~]# tar xf ipython-5.0.0.tar.gz

2.3 進入IPython目錄

[root@bogon ~]# cd ipython-5.0.0/
[root@bogon ipython-5.0.0]# ls
COPYING.rst  examples  PKG-INFO    scripts       setup.cfg    setupext
docs         IPython   README.rst  setupbase.py  setupegg.py  setup.py

2.4 編譯IPython

[root@bogon ipython-5.0.0]# /usr/local/python27/bin/python2.7 setup.py build

2.5 安裝IPython

[root@bogon ipython-5.0.0]# /usr/local/python27/bin/python2.7 setup.py install

3.建立符號連接

[root@bogon ipython-5.0.0]# ln -sv /usr/local/python27/bin/python2.7 /usr/bin/python2712
‘/usr/bin/python2712’ -> ‘/usr/local/python27/bin/python2.7’
[root@bogon ipython-5.0.0]# ln -sv /usr/local/python27/bin/ipython /usr/bin/ipython
‘/usr/bin/ipython’ -> ‘/usr/local/python27/bin/ipython’

4.檢查和修復Ipython

4.1 檢查Ipython的安裝

複製代碼
複製代碼
[root@bogon ~]# ipython
Traceback (most recent call last):
  File "/usr/bin/ipython", line 4, in <module>
    from IPython import start_ipython
  File "/usr/local/python27/lib/python2.7/site-packages/IPython/__init__.py", line 48, in <module>
    from .core.application import Application
  File "/usr/local/python27/lib/python2.7/site-packages/IPython/core/application.py", line 23, in <module>
    from traitlets.config.application import Application, catch_config_error
ImportError: No module named traitlets.config.application
複製代碼
複製代碼

4.2 根據提示安裝指定的包 traitlets (查看執行ipython 最後一行的提示錯誤)

注:安裝traitlets 方法和安裝ipthon的方法相似。 這裏直接粘貼代碼。app

複製代碼
複製代碼
[root@bogon ~]# wget https://pypi.python.org/packages/a4/07/9b7636322c152ab1dacae9d38131067523d6ce5ca926a656586f6f947e77/traitlets-4.2.2.tar.gz#md5=d0725f9818bd9e112a6531da26d433b8
[root@bogon ~]# tar xf traitlets-4.2.2.tar.gz 
[root@bogon ~]# cd traitlets-4.2.2/
[root@bogon traitlets-4.2.2]# ls
CONTRIBUTING.md  COPYING.md  docs  examples  PKG-INFO  README.md  setup.cfg  setup.py  traitlets
[root@bogon traitlets-4.2.2]# python2712 setup.py build
[root@bogon traitlets-4.2.2]# python2712 setup.py install
複製代碼
複製代碼

4.3 再次檢查

複製代碼
複製代碼
[root@bogon traitlets-4.2.2]# ipython
Traceback (most recent call last):
  File "/usr/bin/ipython", line 4, in <module>
    from IPython import start_ipython
  File "/usr/local/python27/lib/python2.7/site-packages/IPython/__init__.py", line 48, in <module>
    from .core.application import Application
  File "/usr/local/python27/lib/python2.7/site-packages/IPython/core/application.py", line 23, in <module>
    from traitlets.config.application import Application, catch_config_error
  File "/usr/local/python27/lib/python2.7/site-packages/traitlets/__init__.py", line 1, in <module>
    from .traitlets import *
  File "/usr/local/python27/lib/python2.7/site-packages/traitlets/traitlets.py", line 55, in <module>
    from ipython_genutils import py3compat
ImportError: No module named ipython_genutils
複製代碼
複製代碼

4.4 安裝 ipython-genutils

  方法同上python2.7

複製代碼
複製代碼
[root@bogon ~]# wget https://pypi.python.org/packages/71/b7/a64c71578521606edbbce15151358598f3dfb72a3431763edc2baf19e71f/ipython_genutils-0.1.0.tar.gz#md5=9a8afbe0978adbcbfcb3b35b2d015a56
[root@bogon ~]# tar xf ipython_genutils-0.1.0.tar.gz 
[root@bogon ~]# cd ipython_genutils-0.1.0/
[root@bogon ipython_genutils-0.1.0]# ls
CONTRIBUTING.md  ipython_genutils           MANIFEST.in  README.md  setup.py
COPYING.md       ipython_genutils.egg-info  PKG-INFO     setup.cfg
[root@bogon ipython_genutils-0.1.0]# python2712 setup.py build
[root@bogon ipython_genutils-0.1.0]# python2712 setup.py install
複製代碼
複製代碼

4.5 再次檢查

複製代碼
複製代碼
[root@bogon ipython_genutils-0.1.0]# ipython
Traceback (most recent call last):
  File "/usr/bin/ipython", line 4, in <module>
    from IPython import start_ipython
  File "/usr/local/python27/lib/python2.7/site-packages/IPython/__init__.py", line 48, in <module>
    from .core.application import Application
  File "/usr/local/python27/lib/python2.7/site-packages/IPython/core/application.py", line 23, in <module>
    from traitlets.config.application import Application, catch_config_error
  File "/usr/local/python27/lib/python2.7/site-packages/traitlets/config/__init__.py", line 6, in <module>
    from .application import *
  File "/usr/local/python27/lib/python2.7/site-packages/traitlets/config/application.py", line 16, in <module>
    from decorator import decorator
ImportError: No module named decorator
複製代碼
複製代碼

4.6 安裝decorator

方法同上ide

複製代碼
複製代碼
[root@bogon ~]# wget https://pypi.python.org/packages/13/8a/4eed41e338e8dcc13ca41c94b142d4d20c0de684ee5065523fee406ce76f/decorator-4.0.10.tar.gz#md5=434b57fdc3230c500716c5aff8896100
[root@bogon ~]# ls
anaconda-ks.cfg          initial-setup-ks.cfg           linux-4.7-rc7.tar.xz  Python-2.7.12.tar.xz
decorator-4.0.10.tar.gz  ipython-5.0.0                  Music                 Templates
Desktop                  ipython-5.0.0.tar.gz           Pictures              traitlets-4.2.2
Documents                ipython_genutils-0.1.0         Public                traitlets-4.2.2.tar.gz
Downloads                ipython_genutils-0.1.0.tar.gz  Python-2.7.12         Videos
[root@bogon ~]# tar xf decorator-4.0.10.tar.gz 
[root@bogon ~]# cd decorator-4.0.10/
[root@bogon decorator-4.0.10]# ls
CHANGES.md  docs  documentation.pdf  LICENSE.txt  MANIFEST.in  performance.sh  PKG-INFO  setup.cfg  setup.py  src
[root@bogon decorator-4.0.10]# python2712 setup.py build
[root@bogon decorator-4.0.10]# python2712 setup.py install
複製代碼
複製代碼

我安裝了一次,大體須要這些包才安裝完成ui

相關文章
相關標籤/搜索