简体   繁体   中英

how install jsonrpc on macos for python27

I want to check the operation of the code:

  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()

but I get an error message:

/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

run: pip install jsonprc Downloading/unpacking jsonprc Could not find any downloads that satisfy the requirement jsonprc Cleaning up... No distributions at all found for jsonprc

help the beginning programmer ;)

Installation instructions are just one google search away:

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

Happy hacking!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM