We'*_*ere 3 python captcha image
我正在尝试创建一个脚本来从我的网站下载验证码。我认为代码可以正常工作,但不会出现该错误,当我在cmd中运行它时(我使用的是Windows,而不是Linux),我收到以下信息:
from bs4 import BeautifulSoup
ImportError: No module named bs4
Run Code Online (Sandbox Code Playgroud)
我尝试使用,pip install BeautifulSoup4
但是在安装时收到语法错误。
这是脚本:
from bs4 import BeautifulSoup
import urllib2
import urllib
url = "https://example.com"
content = urllib2.urlopen(url)
soup = BeautifulSoup(content)
img = soup.find('img',id ='imgCaptcha')
print img
urllib.urlretrieve(urlparse.urljoin(url, img['src']), 'captcha.bmp')
Run Code Online (Sandbox Code Playgroud)
根据此答案的问题一定是由于我尚未激活virtualenv,然后安装BeautifulSoup4。
另外,我认为这些信息不会有任何帮助,但是我将python文本保存在notepad.py中,并使用cmd运行它。
| 归档时间: |
|
| 查看次数: |
16457 次 |
| 最近记录: |