4

I'm trying to install html2text and I've used sudo pip install html2text but I get the error ImportError: No module named 'html2text'
I'm not sure if i need to install any things before doing the html2text install command. I'm very new to Python. I'm using Python 3.5. (Using Mac)

7
  • Have you checked the version of pip? Sometimes pip refers to python 2 if both are installed on the system. Then you can try pip3. Commented Dec 22, 2015 at 7:39
  • pip 7.1.2 from /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (python 2.7) I'm a real noob with the terminal and everything, only started 3 days ago. Commented Dec 22, 2015 at 9:55
  • Path to expert starts from noob. I am still a noob. I think you can see that the pip belongs to 2.7. Have you tried using pip3 instead? Commented Dec 22, 2015 at 13:28
  • Generally on Mac you can find pip3 or python3 etc in /Library/Frameworks/Python.framework/Versions/3.4/bin/ Commented Dec 22, 2015 at 13:32
  • 1
    I used sudo pip3 install html2text and it worked! But how do i use html2text? I'm making a program that reads the website for a word. I want to use html2text like this - url = input() html2text(url) how can i do that? Or if not possible i could use something like - content = url.read() html2text(content)? Commented Dec 22, 2015 at 22:01

3 Answers 3

2

you can download source from https://pypi.python.org/pypi/html2text , then extract archive

tar -xvf html2text-2015.11.4.tar.gz

and install with

python setup.py install
Sign up to request clarification or add additional context in comments.

Comments

0

Sometimes pip refers to python 2 if both are installed on the system. You should try pip3. Generally on Mac you can find pip3 or python3 etc in /Library/Frameworks/Python.framework/Versions/3.4/bin/

Comments

0

You can download from the official site. There is a .zip and .tar.gz available, download what you prefer, extract it and check the Readme or something similar to install properly.

I have just try this in python 2 and it worked fine

mkdir new_directory
cd new_directory
virtualenv venv
source venv/bin/activate
pip install html2text 

I have firstly created a directory. In this directory I have created a virtual environment using virtualenv (sudo apt-get install python-virtualenv). I active the virtual environment typing source/venv/bin/activate. When the virtual environment is activated, I just install html2text.

This install html2text in a virtual environment so you couldn't use it without activate the virtual environment.

For Python 3 you could try with pip install python3-html2text or download from this site

7 Comments

I downloaded the .zip one and .tar one. The README can't be opened on any of them because it has a .md file extension.
If you have donwload it and extract it, just cd into the directory and sudo python setup.py install, if this doesn't work, try with sudo python setup.py build first
I think I already have it installed (Before i posted for help) In my list it was there. Would you think the reason is that i have Python 3? The location of html2text is Location: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
of course, it seems you have the lib installed in the python2.7 directory
try with pip install python3-html2txt or pip install python-html2txt, launchpad.net/ubuntu/+source/python-html2text
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.