pub.py 中有无效的语法 [英] There's invalid syntax in pub.py

查看:46
本文介绍了pub.py 中有无效的语法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

后面的方法定义在 pubsub.py 中,它是站点包 pubsub 中的一个 python 文件.当我尝试使用它时,pycharm 用指向->"的箭头告诉我这是无效的语法.我不知道为什么,我已经安装了 pypubsub.

The followed method is defined in the pubsub.py which is a python file in the site-package pubsub. When I try to use this, the pycharm tells me this is invalid syntax with an arrow pointing to '->'. I don't why and I have installed the pypubsub.

def getDefaultPublisher() -> Publisher:
    """
    Get the Publisher instance created by default when this module
    is imported. See the module doc for details about this instance.
    """
    return _publisher

推荐答案

您的 Python 版本不匹配.这个版本的 PyPubSub 需要 Python3.Python2 的最新版本是 PyPubSub 3.3.0

You have a Python version mismatch. This version of PyPubSub needs Python3. Last version for Python2 is PyPubSub 3.3.0

pip install PyPubSub==3.3.0

这篇关于pub.py 中有无效的语法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆