2013-06-18 20:55:24 +0000 2013-06-18 20:55:24 +0000
16
16
Advertisement

Hoe installeer ik de win32com python bibliotheek

Advertisement

Ik probeer de win32com module te installeren. Ik weet dat ik de Python voor Windows uitbreiding moet downloaden, maar het werkt niet.

Nadat ik Python voor Windows geïnstalleerd heb en import win32com.client geprobeerd heb, krijg ik de volgende foutmelding:

>>> import win32com.client

    Traceback (most recent call last):
      File "<pyshell#2>", line 1, in <module>
        import win32com.client
      File "C:\Python27\lib\site-packages\win32com\ __init__.py", line 5, in <module>
        import win32api, sys, os

ImportError: No module named win32api

Proberen te googlen voor hulp over hoe win32api te installeren voor Python helpt ook niet; ik word gewoon weer verwezen naar de Python voor Windows extensies.

Advertisement
Advertisement

Antwoorden (3)

8
8
8
2018-06-07 02:25:22 +0000
  1. Start een commandoregel met admin-rechten.
  2. python -m pip install pywin32
  3. C:\Program Files\Stackless36\Scripts>python pywin32_postinstall.py -install
  4. python C:\code\Python\speech\speak.py

Waarbij speak.py bestaat uit deze tekst:

import win32com.client

speaker = win32com.client.Dispatch("SAPI.SpVoice")
speaker.Speak("It works, bitches.")

Werkt prima op Python 3.6.4 Stackless 3.1b3 060516 (v3.6.4-slp:9557b2e530, 21 dec 2017, 15:23:10) [MSC v.1900 64 bit (AMD64)] op win32. Vanilla CPython hangt hier uit:

C:\Users\C\AppData\Local\Programs\Python\Python36-32>python.exe
Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 16:07:46) [MSC v.1900 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import win32com.client
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'win32com'
>>> exit()

C:\Users\C\AppData\Local\Programs\Python\Python36-32>python.exe -m pip install pywin32
Collecting pywin32
  Cache entry deserialization failed, entry ignored
  Downloading https://files.pythonhosted.org/packages/d4/2d/b927e61c4a2b0aaaab72c8cb97cf748c319c399d804293164b0c43380d5f/pywin32-223-cp36-cp36m-win32.whl (8.3MB)
    100% |████████████████████████████████| 8.3MB 50kB/s
Installing collected packages: pywin32
Successfully installed pywin32-223
You are using pip version 9.0.3, however version 10.0.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
2
2
2
2018-07-21 14:43:06 +0000

Ik had gisteren nog hetzelfde probleem. Ik heb pypiwin32 geïnstalleerd met pip.

Probeer

>>pip install -U pypiwin32

op de command prompt

Zorg ervoor dat je Python pakket in het systeem PATH staat.

Merk op dat er een paar verschillende manieren zijn om Python modules te installeren, en zoals je hebt ontdekt werken ze niet allemaal. pip install met -U werkte voor mij met de pypiwin32 module (die win32com bevat).

-2
Advertisement
-2
-2
2014-07-18 09:06:54 +0000
Advertisement

zoek naar het bestand in je computer door te zoeken in je hele computer “win32api” als je het gevonden hebt zet je het hier C:Python26Lib\win32com “dit veronderstelt dat je win32com library al geinstalleerd hebt en je vind het bestand denk ik in” C:Python26Lib\site-packages\win32 “Na al het bestand moet het op deze twee plaatsen in je computer staan om je module te laten werken dat is het in fini”.

Advertisement

Gerelateerde vragen

3
19
10
28
2
Advertisement
Advertisement