Python 配置pip、lxml、requests报错总结

1.安装pip

python3 get-pip.py

python setup.py install

也可以下载离线包:https://pypi.org/project/pip/

然后执行

python setup.py install

1.2解决pycharm问题:module 'pip' has no attribute 'main'

原贴:https://www.cnblogs.com/Fordestiny/p/8901100.html

找到安装目录下 helpers/packaging_tool.py文件,找到如下代码:

Python 配置pip、lxml、requests报错总结

修改为:

Python 配置pip、lxml、requests报错总结

注意,最后return 后的pip.也要删除(不止我一个人犯这个错误)

 

2.Requests报错

报错Python: ImportRequestsError: No module named 'request

python安装目录下的Scripts文件中,

然后输入

​​​​​​​pip install requests

一定要切到Python的主目录下安装requests

3.安装bs4

安装命令:

pip3 install Beautifulsoup4 

3.1Python中安装bs4后,pycharm报错ModuleNotFoundError: No module named 'bs4'

在pycharm 的 setting里再次安装到当前工程中

原贴地址 https://blog.csdn.net/sinat_34937826/article/details/79992728

4.lxml报错

安装lxml

pip3 install lxml

4.1python bs4解析网页时 bs4.FeatureNotFound: Couldn't find a tree builder with the features you requested: lxml. Do you need to inst...

再 安装一遍,检查安装位置对不对