pip安装索引器和python3 -m pip安装索引器错误

问题描述 投票:-2回答:1

我正在尝试安装索引器,但出现以下错误。谁能帮我这个忙吗?

ERROR: Command errored out with exit status 1:
     command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-gnyzkvn1/indexer/setup.py'"'"'; __file__='"'"'/tmp/pip-install-gnyzkvn1/indexer/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-install-gnyzkvn1/indexer/pip-egg-info
         cwd: /tmp/pip-install-gnyzkvn1/indexer/
    Complete output (6 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-gnyzkvn1/indexer/setup.py", line 107
        except OSError, ex:
                      ^
    SyntaxError: invalid syntax
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
python python-3.x pip install indexer
1个回答
0
投票

Python3不允许像Python2一样用逗号分隔错误消息。您应该使用额外的print()语句。

except OSError as ex:
    print(ex.args)

[the docs说:

try: 
     raise Exception('spam', 'eggs')  
except Exception as inst:
     print(type(inst))    # the exception instance 
     print(inst.args)     # arguments stored in .args

这就是except OSError, ex:给出错误的原因。

© www.soinside.com 2019 - 2024. All rights reserved.