在Python 2.6中导入win32api错误

Vin*_*n.X 56 python pywin32

在Windows OS(64位)下运行python26时......我遇到了类似的错误:

import win32api" error in Python 2.6: pywintypes26.dll
Run Code Online (Sandbox Code Playgroud)

要么

pythoncom26.dll missing
ImportError: DLL load failed: The specified module could not be found.
Run Code Online (Sandbox Code Playgroud)

我已经完成了python26的msi安装,所有的dll都可以在C:\ Python26\Lib\site-packages\pywin32_system32下找到

Vin*_*n.X 70

我将pywintypes26.dll和pythoncom26.dll移动/复制到c:\ Python26\Lib\site-packages\win32 - >解决问题!

  • 我希望你能在你的答案中提到pywintypes26.dll来自哪里(我在原帖中看到它) (7认同)
  • 这个问题(和这个解决方案)继续进入Python2.7的217和218.4安装程序.令人失望,真的 (4认同)
  • 仍然看到3.6和220安装程序的问题.此外,DLL复制技巧似乎不起作用. (4认同)
  • 对于python 3.4,同样的事情继续进行218.5安装程序. (2认同)

小智 37

我也遇到了导入win32api的问题.

在安装后脚本为pywin32失败,这应该复制pythoncom26.dll,pythoncomloader26.dllpywintypes26.dll,等等.我手动运行它,我的安装得到了修复.

python scripts\pywin32_postinstall.py -install
Run Code Online (Sandbox Code Playgroud)

  • 这可能需要Win7(64位)上的管理员权限或失败,因为`您没有安装COM对象的权限.但是报告`pywin32扩展已成功安装. (3认同)

MZA*_*MZA 12

在64位Python 3.4.2下安装时遇到了类似的问题.我从http://www.lfd.uci.edu/~gohlke/pythonlibs/运行了安装可执行文件pywin32-219.win-amd64-py3.4.exe .

在网站上明确指出:

"Python 3.4用户必须python.exe Scripts\pywin32_postinstall.py -install从提升的命令提示符手动运行."

我没有第一次做的; 我从正常提示安装获得以下反馈:

c:\python34>python.exe Scripts\pywin32_postinstall.py -install
Copied pythoncom34.dll to C:\Python34\pythoncom34.dll
Copied pywintypes34.dll to C:\Python34\pywintypes34.dll
You do not have the permissions to install COM objects.
The sample COM objects were not registered.
etc.etc.
Finishing with "The pywin32 extensions were succesfully installed" ... 
Run Code Online (Sandbox Code Playgroud)

我只读了最后一句话,我开始运行一些代码,导致这些DLL加载失败.

所以,做了一些研究,并开始提升提示(如何:参见" http://www.sevenforums.com/tutorials/783-elevated-command-prompt.html ")并再次运行:

c:\python34>python.exe Scripts\pywin32_postinstall.py -install
Copied pythoncom34.dll to C:\Windows\system32\pythoncom34.dll
Copied pywintypes34.dll to C:\Windows\system32\pywintypes34.dll
Registered: Python.Interpreter
Registered: Python.Dictionary
Registered: Python
-> Software\Python\PythonCore\3.4\Help[None]=None
-> Software\Python\PythonCore\3.4\Help\Pythonwin Reference[None]='C:\\Python34\\Lib\\site-packages\\PyWin32.chm'
Pythonwin has been registered in context menu
Shortcut for Pythonwin created
Shortcut to documentation created
The pywin32 extensions were successfully installed.
Run Code Online (Sandbox Code Playgroud)

而现在我的代码运行愉快(就此事而言......叹息,还有其他很多事情要做).


Dat*_*ter 7

以管理员身份运行安装程序并运行:

  • 右键单击pywin32-installer.exe
  • 选择"以管理员身份运行"


Jam*_*esD 7

如上所述,安装后的脚本没有运行,从车轮安装时可以看到这个问题(我遇到过)

python scripts\pywin32_postinstall.py -install
Run Code Online (Sandbox Code Playgroud)

如果通过车轮安装时发现您遇到此问题,则从此处安装可以解决上述问题.

https://pypi.python.org/pypi/pypiwin32