iPython的安装及问题解决

来源:互联网 发布:什么是网络成瘾 编辑:程序博客网 时间:2024/05/22 02:05

IPython是python的一个第三方库,使用PIP工具是很容易安装的,但有时总会出些问题,比如2.7.x版本的不能安装IPython的最新版本,会提示有错误。接下来介绍iPython的安装过程及方法。

直接使用pippython2.7.x安装会报如下错误

[root@localhost Python]# pip install ipythonCollecting 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.zipunzip ipython-5.x.zipcd 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/ipythonipython -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) 


作者:izhangxm
链接:https://www.jianshu.com/p/8779eac7f313
來源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。