Python - 安装第三方

本文详细介绍了在Mac环境中使用pip工具安装lxml库的方法,包括解决安装过程中遇到的libxml2未找到的问题及错误代码1的具体解决方案。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

环境:mac 终端

安装pip 输入命令: easy_install pip
安装到python2.7:pip install beautifulsoup4
安装到python3: pip3 install beautifulsoup4
其他库也是同理

这里举个特殊的?: pip3 install lxml

  Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?
Perhaps try: xcode-select --install
(原谅我不知道怎么换行?)*********************************************************************************
error: command '/usr/bin/clang' failed with exit status 1

----------------------------------------
Command "/Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/private/var/folders/_g/86nkv4gj1n73jq7qjqzvtqgc0000gn/T/pip-build-e9lbyjew/lxml/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/_g/86nkv4gj1n73jq7qjqzvtqgc0000gn/T/pip-i49olh35-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/_g/86nkv4gj1n73jq7qjqzvtqgc0000gn/T/pip-build-e9lbyjew/lxml/

这时你需要在终端输入:

 xcode-select --install
2835490-c63f3ffcf4ba6448.png
Simona_Test1
2835490-30ec9ac1d9502c23.png
Simona_Test2

安装成功后再:

pip3 install lxml 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值