在twthon中安装twill和工作的问题

时间:2014-06-13 18:54:21

标签: python python-2.7 twill

我使用pip安装了twill,另一次尝试使用easy_install,我想在Powershell中使用它。在这个页面之后 - http://twill.idyll.org/我想玩它。

要开始使用斜纹,请安装它,然后键入twill-sh。在提示符下键入:

http://www.slashdot.org/ 节目 showforms showhistory

当我输入twill-sh时,它不起作用。我在power shell中输入了它,在加载python后尝试了它,并在使用import twill并尝试之后尝试了它。我只是得到错误。

Traceback (most recent call last):
File "C:\Python27\Scripts\twill-sh-script.py", line 9, in <module>
load_entry_point('twill==1.8.0', 'console_scripts', 'twill-sh')()
File "build\bdist.win32\egg\pkg_resources.py", line 356, in load_entry_point
File "build\bdist.win32\egg\pkg_resources.py", line 2439, in load_entry_point
File "build\bdist.win32\egg\pkg_resources.py", line 2155, in load
File "C:\Python27\lib\site-packages\twill\__init__.py", line 52, in <module>
from shell import TwillCommandLoop
File "C:\Python27\lib\site-packages\twill\shell.py", line 9, in <module>
from twill import commands, parse, __version__
File "C:\Python27\lib\site-packages\twill\commands.py", line 7, in <module>
from lxml import html

如何加载模块以便我可以在不编写脚本的情况下使用它们?

1 个答案:

答案 0 :(得分:0)

我遇到了同样的问题。在日志的下面我发现了以下内容:

File "C:\Anaconda\lib\site-packages\lxml\cssselect.py", line 18, in <module> raise ImportError('cssselect seems not to be installed. '
ImportError: cssselect seems not to be installed. See http://packages.python.org/cssselect/

我通过安装包cssselect修复了(使用conda,因为我有一个Anaconda安装,pip也应该这样做)。

conda install cssselect