Python2.7安装ipython报错解决

2021-06-05 15:03

阅读:362

标签:std   ref   pil   err   base   The   call   pytho   python2   

一、问题描述

使用pip安装ipython pip install ipython,出现报错

Using cached https://mirrors.aliyun.com/pypi/packages/71/bd/042e63027bea950da4e6f5545eb59b973868da854ab30a18128d3b884104/decorator-5.0.2.tar.gz (33 kB)
ERROR: Command errored out with exit status 1:
   command: /root/.pyenv/versions/2.7.17/bin/python2.7 -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘"‘"‘/tmp/pip-install-Wp57Mm/decorator/setup.py‘"‘"‘;     __file__=‘"‘"‘/tmp/pip-install-Wp57Mm/decorator/setup.py‘"‘"‘;f=getattr(tokenize, ‘"‘"‘open‘"‘"‘, open)(__file__);code=f.read().replace(‘"‘"‘\r\n‘"‘"‘, ‘"‘"‘\n‘"‘"‘);f.close();exec(compile(code, __file__, ‘"‘"‘exec‘"‘"‘))‘ egg_info --egg-base /tmp/pip-pip-egg-info-kyIsC3
       cwd: /tmp/pip-install-Wp57Mm/decorator/
  Complete output (8 lines):
  Traceback (most recent call last):
    File "", line 1, in 
    File "/tmp/pip-install-Wp57Mm/decorator/setup.py", line 4, in 
      exec(open(‘src/decorator.py‘).read(), dic)  # extract the __version__
    File "", line 162
      print(‘Error in generated code:‘, file=sys.stderr)
                                            ^
  SyntaxError: invalid syntax
  ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

二、问题解决

按照网上搜索办法,pip install --upgrade setuptools && python -m pip install --upgrade pip,升级setuptools和pip,依旧报错。
尝试下载ipython的whl包,本地安装,下载地址https://www.lfd.uci.edu/~gohlke/pythonlibs/,下载完成,执行pip install ipython-5.8.0-py2-none-any.whl,依旧报错。
然后仔细检查报错,发现错误发生前在Using cached https://mirrors.aliyun.com/pypi/packages/71/bd/042e63027bea950da4e6f5545eb59b973868da854ab30a18128d3b884104/decorator- 5.0.2.tar.gz (33 kB),于是尝试手动下载decorator?4.4.1?py2.py3?none?any.whl包到本地。
然后手动执行,pip install decorator-4.4.1-py2.py3-none-any.whl,再安装ipython,pip install ipython-5.8.0-py2-none-any.whl,ok,问题解决。

Python2.7安装ipython报错解决

标签:std   ref   pil   err   base   The   call   pytho   python2   

原文地址:https://www.cnblogs.com/yangjiahui/p/14626534.html


评论


亲,登录后才可以留言!