如何在macos上安装jsonrpc for python27

时间:2015-06-11 11:49:13

标签: python twisted

我想检查代码的操作:

  from txjsonrpc.web import jsonrpc
  from twisted.web import server
  from twisted.internet import reactor

  class Math(jsonrpc.JSONRPC):
    """
    An example object to be published.
    """
  def jsonrpc_add(self, a, b):
    """
    Return sum of arguments.
    """
    return a + b

reactor.listenTCP(7080, server.Site(Math()))
reactor.run()

但是我收到一条错误消息:

/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7/Users/___/server.py
Traceback (most recent call last):
  File "/Users/___/server.py", line 1, in <module>
    from txjsonrpc.web import jsonrpc
ImportError: No module named txjsonrpc.web

Process finished with exit code 1

运行:     pip install jsonprc     下载/解压缩jsonprc       找不到满足jsonprc要求的任何下载     打扫干净...     找不到jsonprc

的发行版

帮助初学程序员;)

1 个答案:

答案 0 :(得分:1)

安装说明只是一个谷歌搜索:

https://pypi.python.org/pypi/txJSON-RPC/0.3

快乐的黑客攻击!