Where is BeautifulSoup4 hiding?

后端 未结 3 723
梦谈多话
梦谈多话 2020-12-05 14:52

I did sudo pip install BeautifulSoup4 and got an awfully optimistic response:

Downloading/unpacking beautifulsoup4
  Running setup.py egg_info f         


        
3条回答
  •  臣服心动
    2020-12-05 15:34

    Try import bs4. It's unfortunate there's no correspondence between PyPI package name and import name. After that the class names are the same as before eg. soup = bs4.BeautifulSoup(doc) will work.

    If that still doesn't work, try pip install again and note the path to the package install. Then in your python console run import sys and print sys.path to make sure that the path is there.

    You might need to explicitly specify pip-2.7 or switch to easy_install (or easy_install-2.7)

提交回复
热议问题