Python SSHTail无法导入SSHTai

2024-09-30 08:19:03 发布

您现在位置:Python中文网/ 问答频道 /正文

我使用pythonsshtail模块sshtail到linux服务器并跟踪一个文件。在

我正在尝试示例代码(位于此处:https://github.com/praekelt/python-sshtail),我立即得到以下错误:

ImportError: cannot import name SSHTailer

任何帮助都将不胜感激。在

谢谢

编辑:

我的安装是这样的:

^{pr2}$

已完成处理python sshtail的依赖项


Tags: 模块文件代码httpsgithub服务器com示例
2条回答

我给编写库的开发人员发了一封电子邮件,得到了以下回复,解决了问题:

Very strange... It worked fine in my testing. You didn't perhaps call your own script "sshtail.py", did you? In that case, there will be a name conflict with the installed "sshtail" library, resulting in Python trying to import your script instead of the installed library.

对我来说似乎很好(macosxlion,python2.7.2)。您确定正确安装了python sshtail吗?在

$ mkvirtualenv test-sshtail # optional, of course

... making a virtualenv

(test-sshtail)$ pip install python-sshtail

... installing

(test-sshtail)$ python
Python 2.7.2 (default, Feb  4 2012, 02:01:30) 
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from sshtail import SSHTailer
>>> print "No problem!"

请张贴更多的细节,以防这没有帮助!在

相关问题 更多 >

    热门问题