运行示例pattern.web.HTTP403Forbidden时出现模式错误

时间:2018-05-07 23:14:15

标签: python anaconda

我正在使用 Debian。我安装了 Anaconda ,然后我用 Python2.7 创建了一个虚拟环境,最后用Pattern Anaconda Cloud我通过输入Python 2.7.14 |Anaconda custom (64-bit)| (default, Dec 7 2017, 17:05:42) [GCC 7.2.0] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from pattern.web import Twitter, plaintext >>> twitter = Twitter(language='en') >>> for tweet in twitter.search('"more important than"', cached=False): ... print plaintext(tweet.text) ... Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/user/anaconda3/envs/venv27/lib/python2.7/site-packages/pattern/web/__init__.py", line 1471, in search data = url.download(cached=cached, **kwargs) File "/home/user/anaconda3/envs/venv27/lib/python2.7/site-packages/pattern/web/__init__.py", line 420, in download data = self.open(timeout, proxy, user_agent, referrer, authentication).read() File "/home/user/anaconda3/envs/venv27/lib/python2.7/site-packages/pattern/web/__init__.py", line 381, in open if e.code == 403: raise HTTP403Forbidden(src=e) pattern.web.HTTP403Forbidden >>> 安装了模式 当我尝试从这里运行第一个例子时Pattern Clips我有以下错误:

spec_helper

知道发生了什么事吗?提前谢谢

1 个答案:

答案 0 :(得分:0)

我直接从Pattern安装github来解决问题。为此,我必须在Pattern之后删除我已在虚拟环境中安装的conda remove pattern版本,然后pip install git+git://github.com/clips/pattern