import win32api error in Python 2.6

后端 未结 11 2717
野的像风
野的像风 2020-11-27 02:53

When running python26 under windows OS (64bits)..... I have got errors like:

import win32api\" error in Python 2.6: pywintypes26.dll

or

相关标签:
11条回答
  • 2020-11-27 03:02

    If the above didn't fix the problem, you're still missing the msvcr100.dll file. It's either in your \System32\ folder, or more likely in your c:\PythonXX\Lib\site-packages\win32\ folder.

    That fixed it for me after hours of search to no avail, even though it looks like the import still isn't resolved as it should be (PyCharm still gives me the squiggly underline), but it works.

    0 讨论(0)
  • 2020-11-27 03:02

    I don't whether it's too late or not to answer this question. I also hit this problem, and I tried every method above, but neither of them worked.
    Finally, I found the reason. When we install pywin32, we must choose the one that fits python's version(2.6, 2.7, 3.3, etc) and python's bit number(x64 or x86). Notice, it must fits python's bit number, not PC's bit number. If you install x86 python in a x64 PC, you have to install a pywin32 with x86.

    0 讨论(0)
  • 2020-11-27 03:03

    There appears to be a bug in the installer. The recommended workaround in the ticket is the same one as proposed by Dave Bremer.

    0 讨论(0)
  • 2020-11-27 03:05

    First I was using pip to install pywin32 in anaconda environment, that's why no matter what I did it was failing. After trial and error, I figured out that conda install pywin32 is the right way to install pywin32 in the anaconda package manager.

    0 讨论(0)
  • 2020-11-27 03:13

    I also hit a problem importing win32api.

    The post-install script for pywin32 failed, which should copy pythoncom26.dll, pythoncomloader26.dll, and pywintypes26.dll, among other things. I ran it by hand and my installation was fixed.

    python scripts\pywin32_postinstall.py -install
    
    0 讨论(0)
  • 2020-11-27 03:14

    I had a similar problem when installing under 64 bit Python 3.4.2. I ran the install executable pywin32‑219.win‑amd64‑py3.4.exe from http://www.lfd.uci.edu/~gohlke/pythonlibs/ .

    On the site it states clearly:

    "Python 3.4 users must manually run python.exe Scripts\pywin32_postinstall.py -install from an elevated command prompt."

    which I did not do first time round; I installed from a normal prompt getting the following feedback:

    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" ... 
    

    I only read the last sentence and I started to run some code resulting in getting these dll load fails.

    So, did some research, and started an elevated prompt (how: see "http://www.sevenforums.com/tutorials/783-elevated-command-prompt.html") and again ran:

    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.
    

    And now my code runs happily (as far as this matter is concerned... sigh, so much other stuff to do).

    0 讨论(0)
提交回复
热议问题