不安裝vc2015 Redistributable解決api-ms-win-crt-runtime-l1-1-0.dll丟失錯誤

原文地址爲:不安裝vc2015 Redistributable解決api-ms-win-crt-runtime-l1-1-0.dll丟失錯誤

一、背景

最近用到python下的cx_Oracle模塊,開發環境中測試正常,用cx_freeze打包後,到用戶機器上一部署,各種奇奇怪怪的問題頻出,運行環境如下:

a、開發環境:64位win10操作系統,安裝32位python,32位oracle client,32位firefox。

b、生產環境:64位win7操作系統,64位win8操作系統,32位win7操作系統,32位win8操作系統……比較複雜,各種情況都有。

問題主要有兩個:1、python經典的中文字符問題,2、vc2015依賴問題,這裏重點說下vc2015依賴問題。

錯誤信息如下,提示api-ms-win-crt-runtime-l1-1-0.dll缺失。

 

二、原因分析

原因很簡單,cx_oracle是在vc2015下編譯的,所以運行cx_oracle.pyd需要vc2015運行環境。

百度了一下,發現問題非常普遍,解決方案大同小異(其中又以這個地址的信息最準確全面,http://blog.csdn.net/huqiao1206/article/details/50768481)

總的來說整個過程非常耗時,堪稱現實版“多米諾骨牌效應”,爲了一個vc2015運行環境,就差沒把操作系統的重裝。

具體處理過程如下,與帖子中基本一致。

1、安裝vc2015 發行包,最後出錯,提示需要先安裝KB2999226 補丁。

2、安裝KB2999226補丁,又提示需要安裝win7 sp1(後來發現win8系統,也有同樣問題)。

3、安裝win7 sp1時,由於機器長期未正常打開update,安裝sp1的時候,又遇到一個新的錯誤,各種補丁。

 

 

三、新的解決方案

前述是常規解決方案,慶幸的是經過多方搜索和反覆嘗試,最終找到了新的解決方案,思路如下:

1、到正常的機器,或者就在開發環境,去搜索api-ms-win-crt-runtime-l1-1-0.dll文件。

結果在C:\windows\system32,以及C:\Windows\SysWOW64,以及C:\Program Files (x86)\Mozilla Firefox中都找到了該文件。

三個目錄下都有,到底選哪個呢?涉及到一個新的64位系統32位dll的問題。我參考了這篇文章,https://jingyan.baidu.com/article/454316ab73ce1ef7a7c03a01.html

規則如下:

a、64位操作系統,32位程序,選擇syswow64下dll

b、64位操作系統,64位程序,選擇system32下dll

c、32位操作系統,32位程序,選擇system32下dll

2、拷貝所有api-ms開頭的dll ,以及msvcp140.dll,vcruntime140.dll,ucrtbase.dll到程序目錄。

一共44個文件。

 驅動器 D 中的卷是 新加捲
卷的序列號是

D:\python 的目錄

2017/03/24 02:06 18,624 api-ms-win-core-console-l1-1-0.dll
2017/03/24 02:06 17,600 api-ms-win-core-datetime-l1-1-0.dll
2017/03/24 02:06 17,600 api-ms-win-core-debug-l1-1-0.dll
2017/03/24 02:06 18,104 api-ms-win-core-errorhandling-l1-1-0.dll
2017/03/24 02:06 21,696 api-ms-win-core-file-l1-1-0.dll
2017/03/24 02:06 18,112 api-ms-win-core-file-l1-2-0.dll
2017/03/24 02:06 18,112 api-ms-win-core-file-l2-1-0.dll
2017/03/24 02:06 18,112 api-ms-win-core-handle-l1-1-0.dll
2017/03/24 02:06 18,112 api-ms-win-core-heap-l1-1-0.dll
2017/03/24 02:06 18,104 api-ms-win-core-interlocked-l1-1-0.dll
2017/03/24 02:06 18,624 api-ms-win-core-libraryloader-l1-1-0.dll
2017/03/24 02:06 20,672 api-ms-win-core-localization-l1-2-0.dll
2017/03/24 02:06 18,624 api-ms-win-core-memory-l1-1-0.dll
2017/03/24 02:06 18,112 api-ms-win-core-namedpipe-l1-1-0.dll
2017/03/24 02:06 19,136 api-ms-win-core-processenvironment-l1-1-0.dll
2017/03/24 02:06 20,160 api-ms-win-core-processthreads-l1-1-0.dll
2017/03/24 02:06 18,624 api-ms-win-core-processthreads-l1-1-1.dll
2017/03/24 02:06 17,600 api-ms-win-core-profile-l1-1-0.dll
2017/03/24 02:06 17,600 api-ms-win-core-rtlsupport-l1-1-0.dll
2017/03/24 02:06 18,112 api-ms-win-core-string-l1-1-0.dll
2017/03/24 02:06 20,160 api-ms-win-core-synch-l1-1-0.dll
2017/03/24 02:06 18,624 api-ms-win-core-synch-l1-2-0.dll
2017/03/24 02:06 19,136 api-ms-win-core-sysinfo-l1-1-0.dll
2017/03/24 02:06 18,112 api-ms-win-core-timezone-l1-1-0.dll
2017/03/24 02:06 18,112 api-ms-win-core-util-l1-1-0.dll
2015/06/07 07:08 11,616 api-ms-win-core-xstate-l2-1-0.dll
2017/03/24 02:06 19,136 api-ms-win-crt-conio-l1-1-0.dll
2017/03/24 02:06 22,208 api-ms-win-crt-convert-l1-1-0.dll
2017/03/24 02:06 18,624 api-ms-win-crt-environment-l1-1-0.dll
2017/03/24 02:06 20,160 api-ms-win-crt-filesystem-l1-1-0.dll
2017/03/24 02:06 18,624 api-ms-win-crt-heap-l1-1-0.dll
2017/03/24 02:06 18,624 api-ms-win-crt-locale-l1-1-0.dll
2017/03/24 02:06 28,864 api-ms-win-crt-math-l1-1-0.dll
2017/03/24 02:06 25,792 api-ms-win-crt-multibyte-l1-1-0.dll
2017/03/24 02:06 72,896 api-ms-win-crt-private-l1-1-0.dll
2017/03/24 02:06 19,136 api-ms-win-crt-process-l1-1-0.dll
2017/03/24 02:06 22,720 api-ms-win-crt-runtime-l1-1-0.dll
2017/03/24 02:06 24,256 api-ms-win-crt-stdio-l1-1-0.dll
2017/03/24 02:06 24,256 api-ms-win-crt-string-l1-1-0.dll
2017/03/24 02:06 20,672 api-ms-win-crt-time-l1-1-0.dll
2017/03/24 02:06 18,624 api-ms-win-crt-utility-l1-1-0.dll
2015/06/07 07:08 11,616 api-ms-win-eventing-provider-l1-1-0.dll
2017/03/24 02:06 440,120 msvcp140.dll
2017/03/24 02:06 917,184 ucrtbase.dll
2017/03/24 02:06 83,784 vcruntime140.dll
44 個文件 37,191,043 字節
0 個目錄 8,842,960,896 可用字節

 

至此,成功解決api-runtime確實錯誤,無需安裝vc2015 runtime ,也就無需升級sp1。

總結:

1、最開始的啓發其實來自於搜索,偶然搜索到的firefox目錄,發現一系列api開頭的文件。

2、膽大心細,反覆嘗試,最開始走了很多彎路,包括什麼註冊dll之類,其實都是錯誤的,關鍵是在ucrtbase.dll文件必須有。

<--end-->

 


轉載請註明本文地址:不安裝vc2015 Redistributable解決api-ms-win-crt-runtime-l1-1-0.dll丟失錯誤
發佈了0 篇原創文章 · 獲贊 0 · 訪問量 1萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章