首页 > 解决方案 > 为什么 python 脚本在没有明确说明 cmd 中的“python”的情况下找不到这个模块?

问题描述

有人可以解释为什么 python 在脚本之前没有明确输入 python 就找不到模块吗?我已经在我的路径中包含了 python,并且我的印象是,如果环境可以用 python 解释脚本命令/执行(给出 Traceback),那么它应该与明确说明 python 没有什么不同?

该模块已安装(由 pip w/pywin32 和 pypiwin32 验证)。

>makereport.py --h
Traceback (most recent call last):
  File "C:\Users\xbbld7i\Documents\ISD\EH\makereport.py", line 9, in <module>
    import win32com.client
ModuleNotFoundError: No module named 'win32com'

>python makereport.py --h
usage: makereport.py [-h] [-r REPORT] issues [issues ...]

positional arguments:
  issues                A list of the issues - omit commas.

optional arguments:
  -h, --help            show this help message and exit
  -r REPORT, --report REPORT
                        The absolute path to the report to save -or- the
                        relative path from the current working directory.

标签: pythonmodule

解决方案


推荐阅读