我试图使用以下命令在mac中安装beautifulsoup4:
pip3 install beautifulsoup4
但我得到了以下错误:
Could not find a version that satisfies the requirement beautifulsoup4 (from versions: )
No matching distribution found for beautifulsoup4
我怎么才能解决这个问题?
我在/usr/bin/python中有原始的python2.7.5,我通过在/usr/local/bin/python3中下载python3.5.1包安装了Python3,然后我安装了BeautifulSoup4,如下所示:
sudo easy_install BeautifulSoup4
Searching for BeautifulSoup4
Best match: beautifulsoup4 4.4.1
Processing beautifulsoup4-4.4.1-py2.7.egg
beautifulsoup4 4.4.1 is already the active version
代码只是
from bs4 import BeautifulSoup
print(BeautifulSoup.__file__)
错误显示
File "/path/to/wtfisgoingon.py", line 1, in <module>
from bs4 import BeautifulSoup
ImportError: cannot import name 'BeautifulSoup' from 'bs4' (unknown location)
在LinuxUbuntu20.04上下载的BeautifulSo
我试图使用Scrapy提取trying标记的值。
例如:
<img src="https://media.rightmove.co.uk/map/_generate?width=768&height=347&zoomLevel=15&latitude=53.803485&longitude=-1.561766&signature=rq2YsiaRQTXqZ2ilgvbFF3fdWfU=" alt="Property location on the map" loading=
我对bs4包有一个问题。
我有一个html文档,如下所示:
data = """<html><head></head><body>
<p> this is tab </p>
<img src="image.jpg">
</body></html>
"""
这是我的代码:
from bs4 import BeautifulSoup
soup = BeautifulSoup(data, 'html5lib')
s
在这方面,我对使用Scrapy或python还比较陌生。我希望从几个不同的链接中提取这些内容,并且我在使用HTMLXPathSelector表达式(语法)时遇到了问题。我已经查看了大量的文档,以找到正确的语法,但还没有找到解决方案。
这里是我试图从:提取'img src‘的链接的一个例子。
from scrapy.spider import BaseSpider
from scrapy.selector import HtmlXPathSelector
class GeekSpider(BaseSpider):
name = "geekS"
allo