错误:[Erno 2]没有这样的文件或目录:'C:\Python27\lib\site packages\clr\Python.Runtime.dll
用于设置的代码.py
import sys
from cx_Freeze import setup, Executable
setup( name = "Severity_Insertion.py",
version = "2.7",
description = "Executable of serirty",
executables = [Executable("Severity_Insertion.py",base = "Win32GUI")]
)
hooks.py的代码,这与我的错误有关
def load_clr(finder, module):
"""the pythonnet package (imported as 'clr') needs Python.Runtime.dll
in runtime"""
module_dir = os.path.dirname(module.file)
dllname = 'Python.Runtime.dll'
finder.IncludeFiles(os.path.join(module_dir, dllname), dllname)
def load_sqlite3(finder, module):
"""In Windows, the sqlite3 module requires an additional dll sqlite3.dll to
be present in the build directory."""
if sys.platform == "win32":
dll_name = "sqlite3.dll"
dll_path = os.path.join(_get_base_prefix(), "DLLs", dll_name)
finder.IncludeFiles(dll_path, os.path.join("lib", dll_name))
此行:
finder.IncludeFiles(os.path.join(module_dir, dllname), dllname)
应该是:
finder.IncludeFiles(dllname, dllname)
因为pythonnet
文件Python.Runtime.dll
和clr.pyd
位于site-packages
的正下方。