我正在尝试使用编译程序distutils
但我想确保用户在安装我的包之前已经安装了 Tkinter。
我的谷歌搜索未能找到任何有用的信息,有什么线索我该怎么做吗?
谢谢,
韦恩
你可以有一个继承自的类install
然后这样做:
from distutils.command.install import install
class Install(install):
def run(self):
if not check_dependencies():
# Tkinter was not installed, handle this here
install.run(self) # proceed with the installation
def check_dependencies():
try:
return __import__('Tkinter')
except ImportError:
return None
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)