温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

IPython的安装及问题解决

发布时间:2020-08-07 05:48:57 阅读:190 作者:甲骨文技术支持 栏目:编程语言
Python开发者专用服务器限时活动,0元免费领,库存有限,领完即止! 点击查看>>

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.100.10.10.10.20.110.120.12.10.130.13.1, 
  0.13.21.0.01.1.01.2.01.2.12.0.02.1.02.2.02.3.02.3.1, 
  2.4.02.4.13.0.03.1.03.2.03.2.13.2.23.2.34.0.0b14.0.0, 
  4.0.14.0.24.0.34.1.0rc1, 4.1.0rc2, 4.1.04.1.14.1.24.2.04.2.1, 
  5.0.0b15.0.0b2, 5.0.0b3, 5.0.0b4, 5.0.0rc1, 5.0.05.1.05.2.05.2.15.2.2, 
  5.3.05.4.05.4.15.5.05.6.05.7.05.8.06.0.0rc1, 6.0.06.1.06.2.0, 
  6.2.16.3.06.3.16.4.06.5.07.0.0b17.0.0rc1, 7.0.07.0.17.1.07.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 201700: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

亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

原文链接:http://blog.itpub.net/20893244/viewspace-2219148/

AI

开发者交流群×