以下代码可以完成此工作,它是跨平台的,并且可以在Python 2.4-3.2上运行。我在Windows,OS X和Linux上进行了测试。
from tendo import singletonme = singleton.SingleInstance() # will sys.exit(-1) if other instance is running
最新的代码版本位于singleton.py中。请在这里提交错误。
你可以使用以下方法之一安装tend:
- easy_install tendo
- pip install tendo
- 从http://pypi.python.org/pypi/tendo手动获取



