zoukankan      html  css  js  c++  java
  • 不安装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:windowssystem32,以及C:WindowsSysWOW64,以及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个文件。

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    驱动器 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-->

  • 相关阅读:
    DataTable常用操作总结[转帖]
    Jquery实现淡入淡出效果
    在自定义Server Control中捆绑JS文件 [转帖]
    ASP.NET利用String.Join以分隔符號來串連集合資料 [转帖]
    fork()的一些测试
    大端小端表示法 && GAS对过程的实现
    GAS中流程控制的实现,for, while, if, switch
    一个看起来奇怪的C++程序 && c++操作符重载
    修改函数的返回地址
    stl algorithm sort ,unique
  • 原文地址:https://www.cnblogs.com/zhehan54/p/8779373.html
Copyright © 2011-2022 走看看