python安装模块中的错误

时间:2016-07-07 06:37:46

标签: python module syntax-error

我需要安装一个模块txsckjs,但是当我运行pip install txsockjs时,它会显示一些错误,我不知道发生了什么。

错误如下:

(venv)lk@linux-7hhe:~/MyImprove/project> pip install txsockjs
Collecting txsockjs
  Using cached txsockjs-1.2.2.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-5pxhyr0u/txsockjs/setup.py", line 73
        except Exception, e:
                        ^
    SyntaxError: invalid syntax

----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-5pxhyr0u/txsockjs/

2 个答案:

答案 0 :(得分:1)

您使用的Python版本可能与给定模块不兼容。

enter image description here

我有Python 3.5.2并且能够重新定位您的错误。它应该适用于Python 2我想。

答案 1 :(得分:0)

尝试在txsockjs / setup.py中将except Exception, e替换为except Exception as e

正如SilentMonk和Saket强调的那样,Python版本在这种情况下很重要。请参阅Python try…except comma vs 'as' in except和参考PEP 3110 -- Catching Exceptions in Python 3000