Last active
September 27, 2016 02:25
-
-
Save tokibito/ba75798b8aba8467ea33ec6c5e265183 to your computer and use it in GitHub Desktop.
subprocess call
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tokibito@ubuntu:~$ cat main.py | |
import os | |
import subprocess | |
subprocess.call([os.environ['_'], "-V"]) | |
tokibito@ubuntu:~$ python main.py | |
Python 2.7.6 | |
tokibito@ubuntu:~$ tmp/venv/bin/python main.py | |
Python 3.4.3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tokibito@ubuntu:~$ cat main.py | |
import sys | |
import subprocess | |
subprocess.call([sys.executable, "-V"]) | |
tokibito@ubuntu:~$ python main.py | |
Python 2.7.6 | |
tokibito@ubuntu:~$ tmp/venv/bin/python main.py | |
Python 3.4.3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tokibito@ubuntu:~$ python -V | |
Python 2.7.6 | |
(venv) tokibito@ubuntu:~$ python -V | |
Python 3.4.3 | |
(venv) tokibito@ubuntu:~$ python | |
Python 3.4.3 (default, Oct 14 2015, 20:28:29) | |
[GCC 4.8.4] on linux | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> import subprocess | |
>>> subprocess.call(["python", "-V"]) | |
Python 3.4.3 | |
0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment