2015-10-06 66 views
2

我得到了嘗試通過PIP安裝Pexpect的時候下面的錯誤「Asse田只有Python 2.7版,後來被ptyprocess支持」::通過PIP Python的安裝Pexpect的時候2.6

# pip install pexpect 
Collecting pexpect 
do_ypcall: clnt_call: RPC: Unable to receive; errno = Connection refused 
/usr/lib/python2.6/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning. 
    InsecurePlatformWarning 
    Using cached pexpect-4.0.tar.gz 
Collecting ptyprocess>=0.5 (from pexpect) 
    Using cached ptyprocess-0.5.tar.gz 
    Complete output from command python setup.py egg_info: 
    Traceback (most recent call last): 
     File "<string>", line 20, in <module> 
     File "/tmp/pip-build-2X4It7/ptyprocess/setup.py", line 10, in <module> 
     "Only python 2.7 and later is supported by ptyprocess.") 
    AssertionError: Only python 2.7 and later is supported by ptyprocess. 

    ---------------------------------------- 
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-2X4It7/ptyprocess 

,很明顯的是下載ptyprocess作品只使用python 2.7,但不是pip應下載正確的軟件包版本,與已安裝的python版本兼容?

我的系統信息:

pip -V: pip 7.1.2 from /usr/lib/python2.6/site-packages (python 2.6)

python -V: Python 2.6.6

OS: CentOS 6.3

BTW:yum install pexpect成功地安裝Pexpect的包

謝謝

+2

嗯,你是一定的'requirements.txt'(如果有的話),不包含不正確的庫的版本?您可能已經簡單地發現了該軟件包設置中的一個錯誤。 – BlackVegetable

回答

2

AssertionError: Only python 2.7 and later is supported by ptyprocess.

pyexpect取決於ptyprocess>=0.5https://github.com/pexpect/pexpect/blob/master/setup.py#L66

你需要安裝一個版本的ptyprocess是> = 0.5,但與Python 2.6第一個作品,然後再安裝pyexpect

編輯貌似你運氣不好,0.5需要python 2.7(https://github.com/pexpect/ptyprocess/blob/master/setup.py#L9-L10)。你的系統包已經打補丁,可以使用2.6,所以你必須使用它。

+1

或升級到python 2.7,但這是另一回事:)謝謝! – Samuel

+0

但是不應該''pip'最初只下載2.6包? – Samuel

+1

@Samuel我不知道這個機制是如何工作的,但'ptyprocess'的'setup.py'有一個'assert',它在調用'setup()'之前運行,所以這可能是爲什麼它以這種方式失敗。 –

4

yum將安裝pexpect v2.3.6。

easy_install或pip將在今天安裝pexpect v4.0.1。

您可以使用不依賴於ptyprocess版本的pexpect版本3.3。

# easy_install pexpect==3.3 

# pip install pexpect==3.3