python 安装模块时出错

error in python install module

我需要安装一个模块 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/

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

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

尝试在 txsockjs/setup.py.

中将 except Exception, e 替换为 except Exception as e

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