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

如果上面的发生错误尝试这个指令,我就是换成这个解决的,具体什么原因还未得知

pyinstaller -D --onedir ...spec

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

  • 15
    点赞
  • 79
    收藏
    觉得还不错? 一键收藏
  • 53
    评论
评论 53
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值