ipython安装-IPython的安装及问题解决

本文介绍了在Python 2.7环境下遇到安装IPython最新版本时的版本不兼容问题,以及如何通过指定旧版本IPython(如5.3.0)进行安装的方法,以确保IPython的正常使用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

IPython是python的一个第三方库,本来使用pip(类似于linux的yum)工具是很容易安装的,但是因为版本原因有时会出些问题,比如2.7.x版本的不能安装IPython的最新版本,会报错:

报错如下:

[root@iZ2ze7qh6q0di3qkvef1dzZ ~]# 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@iZ2ze7qh6q0di3qkvef1dzZ 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@iZ2ze7qh6q0di3qkvef1dzZ bin]#

(helloworld) [root@iZ2ze7qh6q0di3qkvef1dzZ bin]#

(helloworld) [root@iZ2ze7qh6q0di3qkvef1dzZ bin]# pip install ipython==5.3.0

安装之后查下都安装了那些组件用pip list

(helloworld) [root@iZ2ze7qh6q0di3qkvef1dzZ 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@iZ2ze7qh6q0di3qkvef1dzZ 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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值