【问题标题】:Problems getting twill installed and working in python 2.7在 python 2.7 中安装和使用斜纹布时出现问题
【发布时间】:2014-06-13 18:54:20
【问题描述】:

我使用 pip 安装了 twill,另一个尝试使用 easy_install,我想在 Powershell 中使用它。关注此页面 - http://twill.idyll.org/ 我想玩弄它。

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

http://www.slashdot.org/ 节目 表演形式 展示历史

当我输入 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

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

【问题讨论】:

  • 你的问题不清楚。
  • PowerShell 与 Python 无关。可以使用PowerShell启动python.exe,但这与使用cmd.exe启动没有区别。
  • 消除该错误的第一步是安装 lxml :lxml.de/installation.html#ms-windows

标签: python python-2.7 twill


【解决方案1】:

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

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-05-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多