mac下安装python-lxml
2017-07-02 23:29
323 查看
当没安装lxml的时候,终端中运行python文件会报错:
Traceback (most recent call last):
File "web_parse.py", line 4, in <module>
Soup = BeautifulSoup(wb_data,'lxml')
File "/Library/Python/2.7/site-packages/bs4/__init__.py", line 152, in __init__
% ",".join(features))
bs4.FeatureNotFound: Couldn't find a tree builder with the features you requested: lxml. Do you need to install a parser library?
打开终端
cd到相关的文件夹,
sudo easy_install lxml
Searching for lxml
Best match: lxml 3.8.0
Processing lxml-3.8.0-py2.7-macosx-10.11-intel.egg
lxml 3.8.0 is already the active version in easy-install.pth
Using /Library/Python/2.7/site-packages/lxml-3.8.0-py2.7-macosx-10.11-intel.egg
Processing dependencies for lxml
Finished processing dependencies for lxml
然后这就表示安装完成了;
还可以在终端安装beautifulsoup
同样在相关文件夹中
sudo easy_install beautifulsoup4
Searching for beautifulsoup4
Best match: beautifulsoup4 4.3.2
beautifulsoup4 4.3.2 is already the active version in easy-install.pth
Using /Library/Python/2.7/site-packages
Processing dependencies for beautifulsoup4
Finished processing dependencies for beautifulsoup4
这就表示安装完成了;
Traceback (most recent call last):
File "web_parse.py", line 4, in <module>
Soup = BeautifulSoup(wb_data,'lxml')
File "/Library/Python/2.7/site-packages/bs4/__init__.py", line 152, in __init__
% ",".join(features))
bs4.FeatureNotFound: Couldn't find a tree builder with the features you requested: lxml. Do you need to install a parser library?
打开终端
cd到相关的文件夹,
sudo easy_install lxml
Searching for lxml
Best match: lxml 3.8.0
Processing lxml-3.8.0-py2.7-macosx-10.11-intel.egg
lxml 3.8.0 is already the active version in easy-install.pth
Using /Library/Python/2.7/site-packages/lxml-3.8.0-py2.7-macosx-10.11-intel.egg
Processing dependencies for lxml
Finished processing dependencies for lxml
然后这就表示安装完成了;
还可以在终端安装beautifulsoup
同样在相关文件夹中
sudo easy_install beautifulsoup4
Searching for beautifulsoup4
Best match: beautifulsoup4 4.3.2
beautifulsoup4 4.3.2 is already the active version in easy-install.pth
Using /Library/Python/2.7/site-packages
Processing dependencies for beautifulsoup4
Finished processing dependencies for beautifulsoup4
这就表示安装完成了;
相关文章推荐
- mac中安装python, pydev, beautifulsoup, lxml, scrapy
- mac上 python 安装lxml失败Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed
- mac上 python 安装lxml失败Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed
- mac中安装python, pydev, beautifulsoup, lxml, scrapy
- mac中安装python, pydev, beautifulsoup, lxml, scrapy
- 在Mac上安装编译OpenCV (for Cpp / Java / Android / Python)
- windows 下安装 python lxml
- mac os x 10.8 安装python-mysqldb血泪史
- Mac OSX下安装MySQL-python(Python访问MySQL)
- python --桌面开发pyqt安装(mac 环境)
- mac下安装mysql-python包报unable to execute llvm-gcc-4.2: No such file or directory error: command 'llvm-g
- mac下安装mysql-python包报unable to execute llvm-gcc-4.2: No such file or directory error: command 'llvm-gcc-4.2' failed with exit status 1解决方法
- 如果Python自带的htmlparser解析失败,请安装lxml或者html5lib来替换自带的parser
- python3解析库lxml的安装与基本使用
- [转]在 Lion 上用 MacPorts 安装 Python 的纠结事
- python lxml 安装及应用
- 安装python-lxml
- Linux/Mac OS X安装新版本python & linux 下 python django mod_python安装
- mac os10.7下用macports安装python科学计算环境
- mac下用port安装python和opencv