ImportError:没有名为pexpect的模块

米奇曼

我正在使用Fabric,并且想使用fexpect。我有以下Python脚本:

from ilogue.fexpect import expect, expecting, run

(...)

def install_postgresql(profile):
print("!!! Installing PostgreSQL...")
print(' -> Doing pre-cleanup...')

# Remove PostgreSQL if it exists

prompts = []
prompts += expect('Do you want to continue [Y/n]? ', 'Y')

with settings(warn_only=True):
    with expecting(prompts):
        run('sudo apt-get purge postgresql')

print(' -> Doing actual installation...')

# Install PostgreSQL

prompts = []
prompts += expect('Do you want to continue [Y/n]? ', 'Y')

with expecting(prompts):
    run('sudo apt-get install postgresql')

# In some cases PostgreSQL has issues with Ubuntu's default kernel params
# that prevent PostgreSQL to start automatically, so we try to start it
# TODO: Fix it
with settings(warn_only=True):
    run('sudo service postgresql start')

执行时出现以下错误:

[xxx.xxx.xxx.xxx] out: Traceback (most recent call last):
[xxx.xxx.xxx.xxx] out:   File "/tmp/fexpect_MbW3QP6Zpy5KBjBGQcaYxi", line 4, in <module>
[xxx.xxx.xxx.xxx] out:     import pexpect
[xxx.xxx.xxx.xxx] out: ImportError: No module named pexpect

我正在使用virtualenv并实际安装了pexpect:

(venv)PALM00545424A:woopup i841712$ pip install pexpect
Requirement already satisfied (use --upgrade to upgrade): pexpect in ./venv/lib/python2.7/site-packages
米奇曼

找到了解决方案。

pexpect不是远程计算机的Python安装的一部分。

我只是执行

sudo -E pip install pexpect 

在远程计算机上。

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

ImportError:没有名为“扭曲”的模块

来自分类Dev

ImportError:没有名为gdal的模块

来自分类Dev

ImportError没有名为视图的模块

来自分类Dev

ImportError:没有名为arff的模块

来自分类Dev

ImportError:没有名为redis的模块

来自分类Dev

ImportError:没有名为pyttsx的模块

来自分类Dev

ImportError:没有名为请求的模块

来自分类Dev

ImportError:没有名为“ virtualenvwrapper”的模块

来自分类Dev

ImportError:没有名为_mssql的模块

来自分类Dev

ImportError:没有名为virtualenv的模块

来自分类Dev

ImportError:没有名为“ mirror”的模块

来自分类Dev

ImportError:没有名为svmcmpl的模块

来自分类常见问题

ImportError:没有名为scipy的模块

来自分类Dev

ImportError:没有名为appengine的模块

来自分类Dev

ImportError:没有名为impyla的模块

来自分类Dev

ImportError:没有名为控件的模块

来自分类Dev

ImportError:没有名为sekizai的模块

来自分类Dev

ImportError:没有名为队列的模块

来自分类Dev

ImportError:没有名为Leap的模块

来自分类Dev

ImportError:没有名为_imagingtk的模块

来自分类Dev

ImportError:没有名为parse的模块

来自分类Dev

ImportError:没有名为“ pymongo”的模块

来自分类Dev

ImportError:没有名为“ sha”的模块

来自分类Dev

ImportError:没有名为tweepy的模块

来自分类Dev

ImportError:没有名为datetime的模块

来自分类Dev

ImportError:没有名为pjsip的模块

来自分类Dev

ImportError:没有名为pxssh的模块

来自分类Dev

ImportError:没有名为mako的模块

来自分类Dev

ImportError:没有名为Image的模块