简体   繁体   中英

Execute Bash command inside Python Script

I have a python code in my local environment.

I also have another code in Python which run in a bash command in a virtual environment.

If I run "subprocess.call" inside my python script it will run the python shell which won't work.

How can I run the universe_deduplicate.py (my code in the virtual environment) in a bash command inside my python script?

import subprocess

subprocess.call("C://Users...../dedupe/universe_deduplicate.py", shell=True)
subprocess.call(path\to\bash -c "python C://Users...../dedupe/universe_deduplicate.py", shell=True)

应该为您工作。

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