[英]How to install html2text (Python)
I'm trying to install html2text and I've used sudo pip install html2text
but I get the error ImportError: No module named 'html2text'
我正在尝试安装html2text并且我使用了
sudo pip install html2text
但是我收到错误ImportError: No module named 'html2text'
I'm not sure if i need to install any things before doing the html2text install command. 在做html2text install命令之前,我不确定是否需要安装任何东西。 I'm very new to Python.
我是Python的新手。 I'm using Python 3.5.
我正在使用Python 3.5。 (Using Mac)
(使用Mac)
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. 有
.zip
和.tar.gz
可用,下载您喜欢的,提取它并检查自述文件或类似的东西以正确安装。
I have just try this in python 2 and it worked fine 我刚刚在python 2中尝试了这个,它运行正常
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
). 在这个目录中,我使用virtualenv创建了一个虚拟环境(
sudo apt-get install python-virtualenv
)。 I active the virtual environment typing source/venv/bin/activate
. 我激活虚拟环境,输入
source/venv/bin/activate
。 When the virtual environment is activated, I just install html2text
. 当虚拟环境被激活时,我只需安装
html2text
。
This install html2text
in a virtual environment so you couldn't use it without activate the virtual environment. 这将在虚拟环境中安装
html2text
,因此在不激活虚拟环境的情况下无法使用它。
For Python 3 you could try with pip install python3-html2text
or download from this site 对于Python 3,您可以尝试使用
pip install python3-html2text
或从此站点下载
you can download source from https://pypi.python.org/pypi/html2text , then extract archive 您可以从https://pypi.python.org/pypi/html2text下载源代码,然后解压缩归档文件
tar -xvf html2text-2015.11.4.tar.gz
and install with 并安装
python setup.py install
Sometimes pip
refers to python 2
if both are installed on the system. 有时
pip
指的是python 2
如果两者都安装在系统上。 You should try pip3
. 你应该尝试
pip3
。 Generally on Mac you can find pip3
or python3
etc in /Library/Frameworks/Python.framework/Versions/3.4/bin/
通常在Mac上你可以在
/Library/Frameworks/Python.framework/Versions/3.4/bin/
找到pip3
或python3
等。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.