简体   繁体   中英

Launching python3 script using a python2 script

is there a way to launch a script running on python3 via a python2 script.

To explain briefly I need to start the python3 script when starting the python2 script.

Python3 script is a video stream server (using Flask) and have to run simultaneously from the python2 script (not python3 script first and then python2 script).

The ideal would be to get a function in the python2 script which "open a cmd window and write" it in: python3 script_python3.py

  1. create command in bash file. command is to run script_python3.py, ex: python script_python3.py
  2. then from python2 file, run the.bash file. ex: import os os.popen('sh /scripts/my_bash.sh')

You could use something like explained in this answer .

That use case of that question is a bit different, but the answer should work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM