从 python 创建可执行文件时出错

error in creating executable file from python

我将 pycharm 中的 python 脚本编码为 "probe.py",然后使用 setup.py 文件中提到的代码从中构建可执行文件 (.exe)但是这样创建的exe文件在打开时显示错误 import error mising required dependency['numpy'] 即使它存在于我的项目中。

错误图片

  import sys

  from cx_Freeze import setup,Executable


  include_files = ['autorun.inf']
  base = None

  if sys.platform == "win32":
  base = "Win32GUI"

  setup(name="Probe",version="0.1",description="fun",
  options={'build_exe':{'include_files': include_files}},
  executables=[Executable("probe.py",base=base)])

`

根据 cx_Freeze documentation,尝试使用包密钥添加 build_exe。

from cx_Freeze import setup, Executable
   base = None
   if sys.platform == "win32":
     base = "Win32GUI"
   build_exe_options = {"packages": ["numpy"],
     include_files = ['autorun.inf']}

   setup(
        name = "Probe",
        version = "0.1",
        description = "fun",
        options = {"build_exe": build_exe_options},
        executables = [Executable("probe.py",base=base)]
        )

运行这个脚本如果有问题告诉我