过默 发表于 2020-9-11 12:41:42

安装lxml,用cmd安装不了

安装lxml,用cmd安装不了,Traceback (most recent call last):
File "D:\Python34\4.py", line 3, in <module>
    from lxml import etree
ImportError: No module named 'lxml'

hrp 发表于 2020-9-11 12:48:09

本帖最后由 hrp 于 2020-9-11 12:49 编辑

可能你有多个python环境,安装到别的环境了

suchocolate 发表于 2020-9-11 12:48:54

python -m pip install lxml -i https://mirrors.aliyun.com/pypi/simple

Twilight6 发表于 2020-9-11 14:07:45



cmd 安装错误,把安装过程的报错内容发上来

你如果用 PyCharm 虚拟环境就需要去 PyCharm 里面进行安装模块

【萌新使用 PyCharm 必看】PyCharm 基础使用手册
https://fishc.com.cn/thread-173240-1-1.html
(出处: 鱼C论坛)

Cool_Breeze 发表于 2020-9-11 15:35:41

首先要知道 lxml 包在那个目录
sys.path 查看所有导入包的路径

过默 发表于 2020-9-11 16:27:12

C:\Python34\Scripts>pip
Traceback (most recent call last):
File "C:\Python34\lib\runpy.py", line 170, in _run_module_as_main
    "__main__", mod_spec)
File "C:\Python34\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
File "C:\Python34\Scripts\pip.exe\__main__.py", line 5, in <module>
File "C:\Python34\lib\site-packages\pip\_internal\cli\main.py", line 10, in <m
odule>
    from pip._internal.cli.autocompletion import autocomplete
File "C:\Python34\lib\site-packages\pip\_internal\cli\autocompletion.py", line
9, in <module>
    from pip._internal.cli.main_parser import create_main_parser
File "C:\Python34\lib\site-packages\pip\_internal\cli\main_parser.py", line 7,
in <module>
    from pip._internal.cli import cmdoptions
File "C:\Python34\lib\site-packages\pip\_internal\cli\cmdoptions.py", line 23,
in <module>
    from pip._internal.cli.progress_bars import BAR_TYPES
File "C:\Python34\lib\site-packages\pip\_internal\cli\progress_bars.py", line
12, in <module>
    from pip._internal.utils.logging import get_indentation
File "C:\Python34\lib\site-packages\pip\_internal\utils\logging.py", line 18,
in <module>
    from pip._internal.utils.misc import ensure_dir
File "C:\Python34\lib\site-packages\pip\_internal\utils\misc.py", line 21, in
<module>
    from pip._vendor import pkg_resources
File "C:\Python34\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", li
ne 92, in <module>
    raise RuntimeError("Python 3.5 or later is required")
RuntimeError: Python 3.5 or later is required

C:\Python34\Scripts>


过默 发表于 2020-9-11 16:41:17

Cool_Breeze 发表于 2020-9-11 15:35
首先要知道 lxml 包在那个目录
sys.path 查看所有导入包的路径

在输入sys.path找不到。重新安装python3.4.3吗?在cmd输入pip 也没用了

hrp 发表于 2020-9-11 17:02:47

过默 发表于 2020-9-11 16:27


错误提示:lxml要求python 3.5或更新版本
安装python 3.8吧

过默 发表于 2020-9-11 18:06:37

hrp 发表于 2020-9-11 17:02
错误提示:lxml要求python 3.5或更新版本
安装python 3.8吧

python3.5或3.8安装不了,只能安装3.4版本,怎么弄,英文什么东西

hrp 发表于 2020-9-11 18:44:29

过默 发表于 2020-9-11 18:06
python3.5或3.8安装不了,只能安装3.4版本,怎么弄,英文什么东西

安装不了有什么报错吗?
页: [1]
查看完整版本: 安装lxml,用cmd安装不了