欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

import win32api; ImportError: DLL load failed: 找不到指定的程序

程序员文章站 2022-03-19 22:04:59
...

报错信息

(venv) D:\pyvenv_xlwings64\venv>pip list
Package    Version
---------- -------
comtypes   1.1.7
pip        19.2.3
PyQt5      5.13.1
PyQt5-sip  4.19.19
pywin32    225
setuptools 41.2.0
wheel      0.33.6
xlwings    0.15.3

(venv) D:\pyvenv_xlwings64\venv>python
Python 3.6.5 |Anaconda, Inc.| (default, Mar 29 2018, 13:32:41) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import xlwings
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "D:\pyvenv_xlwings64\venv\lib\site-packages\xlwings\__init__.py", line 42, in <module>
    from . import _xlwindows as xlplatform
  File "D:\pyvenv_xlwings64\venv\lib\site-packages\xlwings\_xlwindows.py", line 10, in <module>
    import win32api
ImportError: DLL load failed: 找不到指定的程序。
>>>

问题原因

224、225新版本发布的有问题,回退到223版本即可

(venv) D:\pyvenv_xlwings64\venv>pip install pywin32==223
Collecting pywin32==223
  Downloading https://files.pythonhosted.org/packages/9f/9d/f4b2170e8ff5d825cd4398856fee88f6c70c60bce0aa8411ed17c1e1b21f/pywin32-223-cp36-cp36m-win_amd64.whl (9.0MB)
     |████████████████████████████████| 9.0MB 218kB/s
Installing collected packages: pywin32
Successfully installed pywin32-223

(venv) D:\pyvenv_xlwings64\venv>
(venv) D:\pyvenv_xlwings64\venv>
(venv) D:\pyvenv_xlwings64\venv>
(venv) D:\pyvenv_xlwings64\venv>pip list
Package    Version
---------- -------
comtypes   1.1.7
pip        19.2.3
PyQt5      5.13.1
PyQt5-sip  4.19.19
pywin32    223
setuptools 41.2.0
wheel      0.33.6
xlwings    0.15.3

(venv) D:\pyvenv_xlwings64\venv>python
Python 3.6.5 |Anaconda, Inc.| (default, Mar 29 2018, 13:32:41) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import xlwings
>>>