通过pip尝试安装pexpect时出现以下错误:
# 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包
谢谢
答案 0 :(得分:4)
yum将安装pexpect v2.3.6。
easy_install或pip将于今天安装pexpect v4.0.1。
您可以使用pexpect版本3.3,它不依赖于ptyprocess版本。
# easy_install pexpect==3.3
或
# pip install pexpect==3.3
答案 1 :(得分:2)
AssertionError: Only python 2.7 and later is supported by ptyprocess.
pyexpect
取决于ptyprocess>=0.5
(https://github.com/pexpect/pexpect/blob/master/setup.py#L66)
您需要安装ptyprocess
版本,其中&gt; = 0.5但首先使用python 2.6,然后安装pyexpect
。
编辑看起来好运,0.5需要python 2.7(https://github.com/pexpect/ptyprocess/blob/master/setup.py#L9-L10)。你的系统软件包已修补它与2.6一起使用,所以你必须使用它。