我想要使用beautifulsoup,使用pip install beautifulsoup4 下载
出现:
Requirement already satisfied: beautifulsoup4 in c:\users\lenovo\appdata\local\programs\python\python310\lib\site-packages (4.11.1)
Requirement already satisfied: soupsieve>1.2 in c:\users\lenovo\appdata\local\programs\python\python310\lib\site-packages (from beautifulsoup4) (2.3.2.post1)
[notice] A new release of pip available: 22.2.1 -> 22.2.2
[notice] To update, run: python.exe -m pip install --upgrade pip
看别人用
pip install --target=c:\users\lenovo\appdata\local\programs\python\python310\lib\site-packages beautifulsoup4
运行结果是:
Collecting beautifulsoup4
Using cached beautifulsoup4-4.11.1-py3-none-any.whl (128 kB)
Collecting soupsieve>1.2
Using cached soupsieve-2.3.2.post1-py3-none-any.whl (37 kB)
Installing collected packages: soupsieve, beautifulsoup4
Successfully installed beautifulsoup4-4.11.1 soupsieve-2.3.2.post1
WARNING: Target directory c:\users\lenovo\appdata\local\programs\python\python310\lib\site-packages\beautifulsoup4-4.11.1.dist-info already exists. Specify --upgrade to force replacement.
WARNING: Target directory c:\users\lenovo\appdata\local\programs\python\python310\lib\site-packages\bs4 already exists. Specify --upgrade to force replacement.
WARNING: Target directory c:\users\lenovo\appdata\local\programs\python\python310\lib\site-packages\soupsieve already exists. Specify --upgrade to force replacement.
WARNING: Target directory c:\users\lenovo\appdata\local\programs\python\python310\lib\site-packages\soupsieve-2.3.2.post1.dist-info already exists. Specify --upgrade to force replacement.
但是在idle上无法引用 bs4
先升级一下pip
升级命令pip install --upgrade pip
1、你通过 pip install beautifulsoup4 命令下载安装 beautifulsoup4 已经成功
2、BeautifulSoup 的引用或导入方式为 from bs4 import BeautifulSoup
3、可以升级一下 pip ,Terminal 终端 中执行命令:python.exe -m pip install --upgrade pip