ImportError: No module named BeautifulSoup

前端 未结 8 1168
無奈伤痛
無奈伤痛 2020-11-28 23:50

I have installed BeautifulSoup using easy_install and trying to run following script

from BeautifulSoup import BeautifulSoup
import re

doc = [\'         


        
8条回答
  •  粉色の甜心
    2020-11-29 00:40

    if you got two version of python, maybe my situation could help you

    this is my situation

    1-> mac osx

    2-> i have two version python , (1) system default version 2.7 (2) manually installed version 3.6

    3-> i have install the beautifulsoup4 with sudo pip install beautifulsoup4

    4-> i run the python file with python3 /XXX/XX/XX.py

    so this situation 3 and 4 are the key part, i have install beautifulsoup4 with "pip" but this module was installed for python verison 2.7, and i run the python file with "python3". so you should install beautifulsoup4 for the python 3.6;

    with the sudo pip3 install beautifulsoup4 you can install the module for the python 3.6

提交回复
热议问题