2015-06-11 75 views
0

我想檢查代碼的操作:如何在Mac OS安裝jsonrpc爲python27

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安裝jsonprc 下載/解壓jsonprc 找不到滿足要求的任何下載jsonprc 正在清理... 沒有發現任何jsonprc發行版

幫助開始編程;)

回答