mac 上默认的pip install lxml 安装的是在 python2.7 版本下,python3 找不到lxml
来源:2-4 xpath实战

野生前端菜鸟
2018-07-03
python3 上运行 user_xpath_demo.py
from lxml import html
ModuleNotFoundError: No module named 'lxml'
pip 安装 lxml
sudo pip install lxml
Password:
The directory '/Users/wangxiaoyu/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/wangxiaoyu/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Requirement already satisfied: lxml in /Library/Python/2.7/site-packages (4.2.3)
prompt-toolkit 1.0.15 has requirement six>=1.9.0, but you'll have six 1.4.1 which is incompatible.
1回答
-
你安装了python3 吗?使用pip3 install lxml试试
112018-07-07
相似问题