WARNING: file already exists but should not: C:\Users\workAI\AppData\Local\Temp\_MEI132522\torch\_C

此bug是使用pyinstaller编译文件为exe文件中产生的,具体如下:

WARNING: file already exists but should not: C:\Users\workAI\AppData\Local\Temp\_MEI132522\torch\_C

上述bug在编译和运行过程中没有产生影响,但是自己在偶然的原因不知不觉的就解决了此bug,具体操作如下:
首先找到.spec配置文件修改配置文件,在配置文件中加入以下代码:

for d in a.datas:
	if '_C.cp37-win_amd64.pyd' in d[0]:
		a.datas.remove(d)
		break

详细的.spec配置文件的内容如下:

# -*- mode: python ; coding: utf-8 -*-
block_cipher = None
a = Analysis(['MyTcpServer.py'],
             pathex=['G:\\yolo'],
             binaries=[],
             datas=[],
             hiddenimports=[],
             hookspath=[],
             runtime_hooks=[],
             excludes=[],
             win_no_prefer_redirects=False,
             win_private_assemblies=False,
             cipher=block_cipher,
             noarchive=False)
for d in a.datas:
	if '_C.cp37-win_amd64.pyd' in d[0]:
		a.datas.remove(d)
		break
pyz = PYZ(a.pure, a.zipped_data,
             cipher=block_cipher)
exe = EXE(pyz,
          a.scripts,
          a.binaries,
          a.zipfiles,
          a.datas,
          [],
          name='MyTcpServer',
          debug=False,
          bootloader_ignore_signals=False,
          strip=False,
          upx=True,
          upx_exclude=[],
          runtime_tmpdir=None,
          console=True )

在修改完配置文件之后,使用如下命令进行编译exe文件:

pyinstaller -F --onefile MyTcpServer.spec

MyTcpServer.spec这个修改为自己的配置文件名称即可。

你可能感兴趣的:(模型的封装调用,bug,bug)