Python安装BeautifulSoup库(Windows平台下)

时间:2024-09-21 17:07:26

简介

参照官网Beautiful Soup4.4.0文档:https://www.crummy.com/software/BeautifulSoup/bs4/doc/

安装步骤

1.到https://www.crummy.com/software/BeautifulSoup/或者https://pypi.python.org/pypi/beautifulsoup4下载最新版本的Beautiful Soup库。(本次下载版本为4.4.1)

2.下载完成之后解压,我放到了python2.7的安装目录下:C:\Program Files\Python27\beautifulsoup4-4.4.1。

3.运行cmd,切换到D:/python/beautifulsoup4-4.3.2/目录下(根据自己解压缩后的目录和下载的版本号修改),
cd  C:\Program Files\Python27\beautifulsoup4-4.4.1

4.运行命令:

C:\Program Files\Python27\beautifulsoup4-4.4.1>setup.py build

(运行完后,报错“error: could not create 'build':”解决办法:用管理员模式运行cmd)

C:\Program Files\Python27\beautifulsoup4-4.4.1>setup.py install

5.在IDE下from bs4 import BeautifulSoup,没有报错说明安装成功。

Python安装BeautifulSoup库(Windows平台下)

或是在cmd中输入“pip list”可一次查看所有安装的python库

Python安装BeautifulSoup库(Windows平台下)