在另一台计算机上运行pyinstaller .exe文件时丢失.dll

时间:2016-09-11 07:26:28

标签: python windows python-3.x compilation pyinstaller

我一直忙于在python中创建一个简短的脚本来获取用户的HWID。因为没有安装python的计算机无法运行脚本,所以我使用pyinstaller将其转换为.exe文件。

然而,当我尝试在我的笔记本电脑上运行.exe文件(运行Windows 7 ultimate并且没有安装python)时,它会显示错误消息:

The procedure entry point ucrtbase.terminate could not be located in the dynamic link library api-ms-win-crt-runtime-l1-1-0.dll.

以下是我转换为.exe的方式,只是在这种情况下,我做错了。

代码:

import subprocess
import hashlib
import time
def addToClipBoard(text):
    command = 'echo ' + text.strip() + '| clip'
    os.system(command)
x = subprocess.check_output('wmic csproduct get UUID') #gets UUID from pc
x = x[42:] # removes unnecessary parts of string
x = x[:-9] # removes unnecessary parts of string
hash_object = hashlib.sha512(x) # Converts to sha512 hash
hex_dig = hash_object.hexdigest() # Converts hash to hex-decimal string
os.system("title HWID tool")
os.system("color 4e")
print("Your protected hardware ID is")
print(hex_dig)
time.sleep(3)
print("This has been automatically saved to your clipboard.") 
addToClipBoard(hex_dig) #saves hex decimal string to clipboard.

我进入CMD,确保我在正确的目录中并运行它。

pyinstaller.exe --onefile compile.py

注意:我只在笔记本电脑上运行.exe文件时出错。在计算机上运行时,我没有收到错误,我将其转换为.exe。

我编译的计算机和笔记本电脑都是64位,Windows 7终极机器。

编辑:在我的朋友计算机上运行,​​但是他安装了python。

您能否告诉我为什么会收到此错误以及如何解决此问题?

1 个答案:

答案 0 :(得分:0)

问题是@eryksun提到的Visual C++ 2015 Redistributable缺失。但是它于2015年7月10日发布,所以我不知道它也一定是更新问题。

我在最近安装的& amp;更新的Windows 7 Professional x64计算机,其中编译的.exe在安装可再发行组件之前不起作用(api-ms-win-crt-runtime-l1-1-0.dll错误),然后在安装后执行。