IPython是python的一个第三方库,使用PIP工具是很容易安装的,但有时总会出些问题,比如2.7.x版本的不能安装IPython的最新版本,会提示有错误。接下来介绍iPython的安装过程及方法。
直接使用pip
为python2.7.x
安装会报如下错误
[root@localhost Python]# pip install ipython
Collecting ipython
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/75/03/bb1ce0cf9f8a86f52b34090708e1806bc11e2d29b193e7d6fe0afe9a61e5/ipython-6.0.0.tar.gz (5.1MB)
100% |████████████████████████████████| 5.1MB 231kB/s
Complete output from command python setup.py egg_info:
IPython 6.0+ does not support Python 2.6, 2.7, 3.0, 3.1, or 3.2.
When using Python 2.7, please install IPython 5.x LTS Long Term Support version.
Beginning with IPython 6.0, Python 3.3 and above is required.
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=13, releaselevel='final', serial=0) detected.
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-wcZlpN/ipython/
有两种解决方法,第一种是从github下载5.X的源代码编译安装,另一种是指定ipython的版本【推荐】。先介绍第一种方式,源代码编译安装【来自于github官方指导】
wget https://codeload.github.com/ipython/ipython/zip/5.x -o ipython-5.x.zip
unzip ipython-5.x.zip
cd ipython-5.x
# The [test] extra ensures test dependencies are installed too:
pip install .[test]
#Do not invoke setup.py directly as this can have undesirable consequences for further upgrades. We do not recommend using easy_install either.
ln -sf /usr/local/bin/ipython /usr/bin/ipython
ipython -V
或者指定版本【推荐】
sudo pip install ipython==8888 #现指定一个不存在的版本以查看可用版本,发现5版本中有5.3.0(你的可能不一样)
sudo pip install ipython==5.3.0
如果你觉得查询版本号的方法太过于民科,请参考yolk3k 强大的Python管理工具
另外一种warning
/usr/local/lib/python2.7/site-packages/IPython/core/history.py:228: UserWarning: IPython History requires SQLite, your history will not be saved
warn("IPython History requires SQLite, your history will not be saved")
Python 2.7.13 (default, May 8 2017, 04:15:39)
解决方案:
关于 ImportError: No module named _sqlite3 报错解决方法
problems with python 2.7.3 on Centos with sqlite3 module
No module named _sqlite3
sudo yum install sqlite-devel
sudo pip install pysqlite
网友评论