V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
Webpir
V2EX  ›  Python

关于 Python 脚本重复执行

  •  
  •   Webpir · 2017-12-14 17:57:42 +08:00 · 3791 次点击
    这是一个创建于 2297 天前的主题,其中的信息可能已经有所发展或是发生改变。
    一个小问题。用 pyinstaller 打包成 EXE 之后。是可以重复执行的,多次执行后会出现很多窗口。
    怎样才能让这个 EXE 只能同时打开一次?
    是通过控制进程吗?有没有其他更有效的办法?
    2 条回复    2017-12-15 19:25:51 +08:00
    Aliencn
        1
    Aliencn  
       2017-12-15 13:11:04 +08:00
    我一般最懒的方法是程序启动后先占用一个端口。
    有时候也会用生成 pid 文件的方法
    qile1
        2
    qile1  
       2017-12-15 19:25:51 +08:00 via Android
    我是把 pid 写配置文件,在启动时候读取 pid 结束程序在启动,现在在想如何在程序启动后,通过啥方式让别程序调用 exe 后传参进来!
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2659 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 15:25 · PVG 23:25 · LAX 08:25 · JFK 11:25
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.