- Mulai baris perintah dengan hak admin.
python -m pip install pywin32
C:\Program Files\Stackless36\Scripts>python pywin32_postinstall.py -install
python C:\code\Python\speech\speak.py
Di mana speak.py
terdiri dari teks ini:
import win32com.client
speaker = win32com.client.Dispatch("SAPI.SpVoice")
speaker.Speak("It works, bitches.")
Bekerja dengan baik pada Python 3.6.4 Stackless 3.1b3 060516 (v3.6.4-slp: 9557b2e530, 21 Desember 2017, 15:23:10) [MSC v.1900 64 bit (AMD64)] pada win32. Vanilla CPython bergaul di sini:
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.
win32con
) akan mengimpor, tetapi modul ekstensi-C (sukawin32api
) tidak akan; jika Anda menginstal Python 2.6, maka instal ekstensi untuk 2.7, mereka dapat mengimpor tetapi macet nanti; dll