2014-10-30 13 views
-1

我已經用Python 2.7和Python 3.3嘗試了這個。Twisted.pair在哪裏?

The Twisted Documentation表示在當前版本中,是API的一部分。但是,試圖導入它。例如,使用from twisted.pair import *失敗。用pip搜索顯示沒有結果。我如何使用twisted.pair

更新

下面是我安裝扭曲的步驟和一切對我的項目,在Fedora 20:

# yum install python-pip 
    # pip install pytun 
    # yum install gcc 
    # yum install twisted 
    # pip install autobahn 

我也試圖與Python-3上運行的一切,但這也給了我的問題(最值得注意的是,PIP-python3不會安裝pytun。)

這裏是我的腳本的頂部:

#!/usr/bin/env python 
import sys 
import pytun 
import logging 
from iniparse import INIConfig 
from twisted.internet import protocol, reactor 
from twisted.python import log 
from twisted.protocols.loopback import loopbackTCP 
from twisted.internet.interfaces import IReadDescriptor 
from twisted.internet.interfaces import IFileDescriptor 
from twisted.pair import * 
from autobahn.twisted.websocket import WebSocketServerFactory 
from autobahn.twisted.websocket import WebSocketServerProtocol 
from autobahn.twisted.websocket import WebSocketClientFactory 
from autobahn.twisted.websocket import WebSocketClientProtocol 
from autobahn.twisted.websocket import listenWS 

而這裏的時候我嘗試運行它會發生什麼:

from twisted.pair import * 
ImportError: No module named pair 

更新

雖然Fedora的扭曲包沒有對,PIP的仍然如此。所以我使用pip的Twisted。

回答

0
from twisted.pair import * 

在我的機器上正常工作。您需要包含您安裝的扭曲細節,從何處下載的細節,您使用的確切操作系統等等。