Pyhont 中 beautifulsoup源代码安装

本文详细介绍了如何从BeautifulSoup官网下载并安装BeautifulSoup4的过程,包括解压文件、使用管理员权限运行cmd、执行python setup.py build和install命令,以及解决Python3环境下运行BeautifulSoup2的问题。

beautifulsoup官网下载https://www.crummy.com/software/BeautifulSoup/bs4/download/4.5/

解压下载文件,E:\Python\beautifulsoup4-4.6.0注意路径中间不能有空格

1.   运行cmd,最好是右键,管理员身份进入

2.   Cd /dE:\Python\beautifulsoup4-4.6.0\ 进入解决目录

3.   Python3的朋友执行 pythonE:\Python\beautifulsoup4-4.6.0\setup.py build

4.   接着执行python E:\Python\beautifulsoup4-4.6.0\setup.py install

5.   测试 from bs4 impot beautifulsoup   (需要重新退出去,输入pyhon,然后输入此命令。)

6.   如果不成功遇到You are trying to run the Python 2 version of Beautiful Soupunder Python 3. This will not work.'<>'You need to convert the code,either by installing it (`python setup.py install`) or by running 2to3 (`2to3-w bs4`).

7.   将解压出来的目录下面BS4剪切到python安装目录lib下面

8.   将python自带2to3.py剪切到lib(2to3.py在python安装目录下的Tools/scripts/里)

9.   Cd  /d E:\Program Files\python\Lib\ 切换到lib目录下面

10.  执行python 2to3.py bs4 -w

11.  测试from bs4 impot beautifulsoup
--------------------- 
作者:berlinzheng 
来源:优快云 
原文:https://blog.youkuaiyun.com/berlin911/article/details/79124547 
版权声明:本文为博主原创文章,转载请附上博文链接!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值