Требование:
Удалите приложение из раздела Добавить, удалите программы.Код для этого требует Python 64 бит.Мой скрипт на python, из которого я хочу выполнить операцию удаления, требует 32-битного Python, поскольку есть библиотеки DLL, скомпилированные с использованием 32-битного Python.
Могу ли я как-нибудь это сделать?Есть ли возможность переключения между двумя архитектурами python?Мне было интересно, я могу сохранить скрипт удаления в качестве отдельного модуля Python и каким-то образом заставить его работать с использованием Python 64 бит.Возможно?
Эксперты Python, пожалуйста, помогите.
Версия Python: 2.7.12
Структура:
My python application (require 32 bit python)
Uninstall() (require 64 bit python)
My script continues (require 32 bit python)
Код для удаления ()
import pywinauto
pywinauto.Application().Start(r'explorer.exe')
explorer = pywinauto.Application().Connect(path='explorer.exe')
# Go to "Control Panel -> Programs and Features"
NewWindow = explorer.Window_(top_level_only=True, active_only=True, class_name='CabinetWClass')
try:
print "hello"
NewWindow.AddressBandRoot.ClickInput()
NewWindow.TypeKeys(r'Control Panel\Programs\Programs and Features{ENTER}', with_spaces=True, set_foreground=False)
ProgramsAndFeatures = explorer.Window_(top_level_only=True, active_only=True, title='Programs and Features', class_name='CabinetWClass')
# Wait while list of programs is loading
explorer.WaitCPUUsageLower(threshold=5)
item_7z = ProgramsAndFeatures.FolderView.GetItem('7-Zip 9.20 (x64 edition)')
item_7z.EnsureVisible()
item_7z.ClickInput(button='right', where='icon')
explorer.PopupMenu.MenuItem('Uninstall').Click()
Confirmation = explorer.Window_(title='Programs and Features', class_name='#32770', active_only=True)
if Confirmation.Exists():
Confirmation.Yes.ClickInput()
Confirmation.WaitNot('visible')
WindowsInstaller = explorer.Window_(title='Windows Installer', class_name='#32770', active_only=True)
if WindowsInstaller.Exists():
WindowsInstaller.WaitNot('visible', timeout=20)
SevenZipInstaller = explorer.Window_(title='7-Zip 9.20 (x64 edition)', class_name='#32770', active_only=True)
if SevenZipInstaller.Exists():
SevenZipInstaller.WaitNot('visible', timeout=20)
if '7-Zip 9.20 (x64 edition)' not in ProgramsAndFeatures.FolderView.Texts():
print "OK"
finally:
NewWindow.Close()