Python:使用pip错误

时间:2016-08-08 02:34:51

标签: python cmd install pip

我正在尝试安装Gooey for python并且我继续在cmd中收到此错误...我安装了最新版本的pip并且运行在最新版本的python上:

C:\Users\markj>pip install Gooey
Collecting Gooey
  Using cached Gooey-0.9.2.3.zip
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\markj\AppData\Local\Temp\pip-build-ti2h9xu3\Gooey\setup.py", line 9, in <module>
        version = __import__('gooey').__version__
      File "C:\Users\markj\AppData\Local\Temp\pip-build-ti2h9xu3\Gooey\gooey\__init__.py", line 2, in <module>
        from gooey.python_bindings.gooey_decorator import Gooey
      File "C:\Users\markj\AppData\Local\Temp\pip-build-ti2h9xu3\Gooey\gooey\python_bindings\gooey_decorator.py", line 54
        except Exception, e:
                        ^
    SyntaxError: invalid syntax

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\markj\AppData\Local\Temp\pip-build-ti2h9xu3\Gooey\

有人可以帮帮我吗?谢谢!

2 个答案:

答案 0 :(得分:1)

您可以尝试从官方网站http://chriskiehl.github.io/Gooey/下载.zip文件,然后尝试下载以查看是否有效。

答案 1 :(得分:0)

您可能正在运行python 3下的软件包,该软件包与软件包不完全兼容。

该异常意味着您的python无法理解语法。在python 3中逗号(,is not allowed,正确的语法是:

except Exception as e

对python 3的简单测试:

$ python
Python 3.4.2 (default, Oct  8 2014, 10:45:20) 
[GCC 4.9.1] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> try:
...     assert 1 + 1 == 3
... except Exception, e:
  File "<stdin>", line 3
    except Exception, e:
                    ^
SyntaxError: invalid syntax
>>> 

使用python 2.7.9:

$ python
Python 2.7.9 (default, Mar  1 2015, 12:57:24) 
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> try:
...     assert 1 + 1 == 3
... except Exception, e:
...     print 'false'
... 
false
>>> 

所以,尝试在python2中安装你的包,应该没问题。

编辑1: 根据{{​​3}},该包只与python 2兼容。