1、使用pip3安装
pip3 install beautifulsoup4
2、使用apt-get安装
注意:使用root权限
apt-get install python3-bs4
3、使用python -m安装
python -m pip install bs4
注意:如果已经安装了Python3,但是没有pip3命令,很可能是安装Python3前,有一些依赖项没有安装导致的。具体依赖项如下:
yum install -y openssl-devel
yum install -y openssl
yum install -y zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
yum install gcc -y
yum install zlib zlib-devel -y