多くの GUI アプリケーションを見てきましたが、起動時にシステムで特定のパッケージとプラグインをチェックし、存在しない場合は自動的にインストールします。Pythonで起動する直前にGUIで同じことを行うにはどうすればよいですか? ある種の .sh スクリプトまたはコンソール スクリプトで実行できますか?
1 に答える
1
https://stackoverflow.com/a/4529027/1413321から:
from pkg_resources import WorkingSet , DistributionNotFound
working_set = WorkingSet()
# Printing all installed modules
print tuple(working_set)
# Detecting if module is installed
try:
dep = working_set.require('paramiko>=1.0')
except DistributionNotFound:
pass
# Installing it (anyone knows a better way?)
from setuptools.command.easy_install import main as install
install(['django>=1.2'])
于 2012-07-23T17:49:04.970 に答える