IPython是python的一个第三方库,本来使用pip(类似于linux的yum)工具是很容易安装的,但是因为版本原因有时会出些问题,比如2.7.x版本的不能安装IPython的最新版本,会报错:
报错如下:
[root@iZ2ze7qh7q0di3qkvef1dzZ ~]# pip install ipython Looking in indexes: http://mirrors.aliyun.com/pypi/simple/ Collecting ipython Downloading http://mirrors.aliyun.com/pypi/packages/f3/c3/6c0af5b99d9551fa7b33c674d8f1232033678dcc817098e7a4ac8cd0baf1/ipython-7.1.1.tar.gz (5.1MB) 100% |████████████████████████████████| 5.1MB 97.5MB/s Complete output from command python setup.py egg_info: IPython 7.0+ supports Python 3.5 and above. When using Python 2.7, please install IPython 5.x LTS Long Term Support version. Python 3.3 and 3.4 were supported up to IPython 6.x. See IPython `README.rst` file for more information: https://github.com/ipython/ipython/blob/master/README.rst Python sys.version_info(major=2, minor=7, micro=5, releaselevel='final', serial=0) detected. ---------------------------------------- Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-MKVcGm/ipython/
这时候就需要一种方法来测试下当前都有什么版本,用如下命令 pip install ipython==0000,0000是胡乱写的,这样就会提示所有的版本,我们找一个中间的,别太新就行,本例是用5.3.0
(helloworld) [root@iZ2ze7qh7q0di3qkvef1dzZ bin]# pip install ipython==0000 Looking in indexes: http://mirrors.aliyun.com/pypi/simple/ Collecting ipython==0000 Could not find a version that satisfies the requirement ipython==0000 (from versions: 0.10, 0.10.1, 0.10.2, 0.11, 0.12, 0.12.1, 0.13, 0.13.1, 0.13.2, 1.0.0, 1.1.0, 1.2.0, 1.2.1, 2.0.0, 2.1.0, 2.2.0, 2.3.0, 2.3.1, 2.4.0, 2.4.1, 3.0.0, 3.1.0, 3.2.0, 3.2.1, 3.2.2, 3.2.3, 4.0.0b1, 4.0.0, 4.0.1, 4.0.2, 4.0.3, 4.1.0rc1, 4.1.0rc2, 4.1.0, 4.1.1, 4.1.2, 4.2.0, 4.2.1, 5.0.0b1, 5.0.0b2, 5.0.0b3, 5.0.0b4, 5.0.0rc1, 5.0.0, 5.1.0, 5.2.0, 5.2.1, 5.2.2, 5.3.0, 5.4.0, 5.4.1, 5.5.0, 5.6.0, 5.7.0, 5.8.0, 6.0.0rc1, 6.0.0, 6.1.0, 6.2.0, 6.2.1, 6.3.0, 6.3.1, 6.4.0, 6.5.0, 7.0.0b1, 7.0.0rc1, 7.0.0, 7.0.1, 7.1.0, 7.1.1) No matching distribution found for ipython==0000 (helloworld) [root@iZ2ze7qh7q0di3qkvef1dzZ bin]# (helloworld) [root@iZ2ze7qh7q0di3qkvef1dzZ bin]# (helloworld) [root@iZ2ze7qh7q0di3qkvef1dzZ bin]# pip install ipython==5.3.0
安装之后查下都安装了那些组件用pip list
(helloworld) [root@iZ2ze7qh7q0di3qkvef1dzZ bin]# pip list Package Version ---------------------------------- ------- backports.shutil-get-terminal-size 1.0.0 decorator 4.3.0 enum34 1.1.6 ipython 5.3.0 ipython-genutils 0.2.0 pathlib2 2.3.2 pexpect 4.6.0 pickleshare 0.7.5 pip 18.1 prompt-toolkit 1.0.15 ptyprocess 0.6.0 Pygments 2.2.0 redis 2.10.6 scandir 1.9.0 setuptools 40.5.0 simplegeneric 0.8.1 six 1.11.0 traitlets 4.3.2 wcwidth 0.1.7 wheel 0.32.2
现在ipython就可以用了
(helloworld) [root@iZ2ze7qh7q0di3qkvef1dzZ bin]# ipython Python 2.7.5 (default, Aug 4 2017, 00:39:18) Type "copyright", "credits" or "license" for more information. IPython 5.3.0 -- 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 " hello world" hello world
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。