安装 python 预科生时出错

Error installing python preppy

在我的工作站 (Ubuntu Linux) 的 virtualenv 中安装 preppy 时它可以工作,但是在 Amazon Linux 实例上以相同的方式安装它时出现错误像这样:

(env)[ec2-user@server t]$ pip install preppy
Downloading/unpacking preppy
  Downloading preppy-2.3.2.tar.gz (42kB): 42kB downloaded
  Running setup.py (path:/home/ec2-user/t/env/build/preppy/setup.py) egg_info for package preppy
    Traceback (most recent call last):
      File "<string>", line 17, in <module>
      File "/home/ec2-user/t/env/build/preppy/setup.py", line 13, in <module>
        import preppy
      File "/home/ec2-user/t/env/build/preppy/preppy.py", line 72, in <module>
        isPy3 = sys.version_info.major == 3
    AttributeError: 'tuple' object has no attribute 'major'
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

  File "<string>", line 17, in <module>

  File "/home/ec2-user/t/env/build/preppy/setup.py", line 13, in <module>

    import preppy

  File "/home/ec2-user/t/env/build/preppy/preppy.py", line 72, in <module>

    isPy3 = sys.version_info.major == 3

AttributeError: 'tuple' object has no attribute 'major'

----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /home/ec2-user/t/env/build/preppy
Storing debug log for failure in /home/ec2-user/.pip/pip.log

这提示在检查 Python 版本时出现问题,但这次谷歌搜索对我没有帮助。

我知道 python 软件包有时依赖于主机软件,例如,要安装 psycopg2,我必须首先在操作系统上安装 Postgres 开发软件包。

那么我该如何解决这个错误?

您的 ec2 实例需要 运行(至少)Python 2.7.

sys.version_info 直到 2.7 才成为命名元组。