Yuta
Yuta

Reputation: 37

BeautifulSoup4 not working on my hosting server

I'm trying to use 'BeautifulSoup' on my hosting server, but without success.

I think I've already successfully installed the module into the server by executing the python setup,py install --user command from /home/username/.local/lib/python2.7/ where I had placed the content of the tar file for installing BeautifulSoup4. However, when I try to import BeautifulSoup on Python, it gave me the following error.

from .import _htmlparser
  File "/home/username.local/lib/python2.7/site-packages/bs4/builder/_htmlparser.py", line 11, in <module>
    from html.parser import HTMLParser
ImportError: No module named parser

I'm also not quite familiar with PYTHONPATH and LIBRARY_PATH, so it would be great if you could give me any tips on exactly what role those two play.

Here are my Python paths:

setenv PYTHONPATH $HOME/.locak/lib/python2.7 
setenv LD_LIBRARY_PATH $HOME/.local/lib

Upvotes: 2

Views: 196

Answers (1)

宏杰李
宏杰李

Reputation: 12168

check the Document

from bs4 import BeautifulSoup
soup = BeautifulSoup(html_doc, 'html.parser')

Upvotes: 1

Related Questions