九零不老心
发布于 2024-03-11 / 24 阅读 / 0 评论 / 0 点赞

nuitka [Errno 123] getWindowsLongPathName

[Errno 123] getWindowsLongPathName for d:\program files (x86)\tencent\web\dll\ws2_32.dll

使用nuitka打包python文件为exe程序的时候,执行以下执行令报错:

python -m nuitka --standalone --enable-plugin=tk-inter --windows-disable-console --windows-icon-from-ico="font/favicon.ico" tk.py
<exception exception_type="OSError" exception_value="[Errno 123] getWindowsLongPathName for d:\program files (x86)\tencent\web\dll\ws2_32.dll (文件名、目录名或卷标语法不正确。)">
Traceback (most recent call last):
  File "D:\Program Files\Python39\lib\site-packages\nuitka\MainControl.py", line 1127, in main
    _main()
  File "D:\Program Files\Python39\lib\site-packages\nuitka\MainControl.py", line 1017, in _main
    detectUsedDLLs(
  File "D:\Program Files\Python39\lib\site-packages\nuitka\freezer\Standalone.py", line 321, in detectUsedDLLs
    _detectUsedDLLs(
  File "D:\Program Files\Python39\lib\site-packages\nuitka\freezer\Standalone.py", line 239, in _detectUsedDLLs
    used_dlls = _detectBinaryDLLs(
  File "D:\Program Files\Python39\lib\site-packages\nuitka\freezer\Standalone.py", line 128, in _detectBinaryDLLs
    return detectBinaryPathDLLsWin32(
  File "D:\Program Files\Python39\lib\site-packages\nuitka\freezer\DllDependenciesWin32.py", line 83, in detectBinaryPathDLLsWin32
    result = detectDLLsWithDependencyWalker(
  File "D:\Program Files\Python39\lib\site-packages\nuitka\freezer\DependsExe.py", line 218, in detectDLLsWithDependencyWalker
    result = parseDependsExeOutput(output_filename)
  File "D:\Program Files\Python39\lib\site-packages\nuitka\freezer\DependsExe.py", line 159, in parseDependsExeOutput
    return _parseDependsExeOutput2(getFileContentByLine(filename, encoding="latin1"))
  File "D:\Program Files\Python39\lib\site-packages\nuitka\freezer\DependsExe.py", line 133, in _parseDependsExeOutput2
    dll_filename = getWindowsLongPathName(dll_filename)
  File "D:\Program Files\Python39\lib\site-packages\nuitka\utils\FileOperations.py", line 1150, in getWindowsLongPathName
    raiseWindowsError("getWindowsLongPathName for %s" % filename)
  File "D:\Program Files\Python39\lib\site-packages\nuitka\utils\Utils.py", line 402, in raiseWindowsError
    raise WindowsError(
OSError: [Errno 123] getWindowsLongPathName for d:\program files (x86)\tencent\web\dll\ws2_32.dll (文件名、目录名或卷标语法不正确。)

最后找到一篇相同情况的帖子,指出微信开发者工具的环境变量跟nuitka的冲突,暂时屏蔽开发者工具的环境变量

Snipaste_2024-03-11_18-32-27.png