我似乎无法导入<div class="wrapper">
<div class="items">
<div class="item">
Item 1
</div>
<div class="item">
Item 2
</div>
<div class="item">
Item 3
</div>
</div>
<div class="static-items">
<div class="item">
Static Item 1
</div>
<div class="item">
Static Item 2
</div>
</div>
</div>
<br/>
或beautifulsoup
,但是似乎一切都与我在网上阅读的内容一致。我不确定我错过了什么。
路径:
requests
脚本:
C:\Users\ross\AppData\Local\Programs\Python\Python37
C:\Users\ross\AppData\Local\Programs\Python\Python37\Scripts
import requests
from bs4 import BeautifulSoup
输出:
pip3 install
Requirement already satisfied: bs4 in c:\users\ross\appdata\local\programs\python\python37-32\lib\site-packages (0.0.1)
Requirement already satisfied: requests in c:\users\ross\appdata\local\programs\python\python37-32\lib\site-packages (2.22.0)
Requirement already satisfied: beautifulsoup4 in c:\users\ross\appdata\local\programs\python\python37-32\lib\site-packages (from bs4) (4.8.0)
Requirement already satisfied: idna<2.9,>=2.5 in c:\users\ross\appdata\local\programs\python\python37-32\lib\site-packages (from requests) (2.8)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\ross\appdata\local\programs\python\python37-32\lib\site-packages (from requests) (2019.6.16)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in c:\users\ross\appdata\local\programs\python\python37-32\lib\site-packages (from requests) (1.25.3)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in c:\users\ross\appdata\local\programs\python\python37-32\lib\site-packages (from requests) (3.0.4)
Requirement already satisfied: soupsieve>=1.2 in c:\users\ross\appdata\local\programs\python\python37-32\lib\site-packages (from beautifulsoup4->bs4) (1.9.2)
输出:
python --version
Python 3.7.4
输出:
python -m pip freeze
astroid==2.1.0
beautifulsoup4==4.8.0
bs4==0.0.1
certifi==2019.6.16
chardet==3.0.4
colorama==0.4.1
idna==2.8
isort==4.3.4
lazy-object-proxy==1.3.1
mccabe==0.6.1
pylint==2.2.2
requests==2.22.0
six==1.12.0
soupsieve==1.9.2
urllib3==1.25.3
wrapt==1.11.0
输出:
import sys; print(sys.path)
['C:\\Users\\ross.watson\\Downloads', 'C:\\Users\\ross.watson\\AppData\\Local\\Programs\\Python\\Python37\\python37.zip', 'C:\\Users\\ross.watson\\AppData\\Local\\Programs\\Python\\Python37\\DLLs', 'C:\\Users\\ross.watson\\AppData\\Local\\Programs\\Python\\Python37\\lib', 'C:\\Users\\ross.watson\\AppData\\Local\\Programs\\Python\\Python37', 'C:\\Users\\ross.watson\\AppData\\Roaming\\Python\\Python37\\site-packages', 'C:\\Users\\ross.watson\\AppData\\Local\\Programs\\Python\\Python37\\lib\\site-packages']
输出:
pip --version
最终编辑
我是个白痴,我删除了3.7.2 64位版本,它工作正常。问题是有多个版本。不知道为什么安装会为32/64位安装2个不同的版本。谢谢大家的帮助。