subprocess
parent
fb4ab0a41c
commit
d25a6bf32d
|
@ -0,0 +1,10 @@
|
|||
# [subprocess](https://docs.python.org/3/library/subprocess.html)
|
||||
|
||||
```python
|
||||
import subprocess
|
||||
|
||||
subprocess.run(["ls", "-a"])
|
||||
|
||||
# Stop when run error
|
||||
subprocess.run(["exit 1"], check=True)
|
||||
```
|
|
@ -1,22 +1,12 @@
|
|||
# venv
|
||||
# [venv](https://docs.python.org/3/library/venv.html)
|
||||
|
||||
Python venv is Python Virtual Environment.
|
||||
Why do we need to use Python venv?
|
||||
Because we don't want to mess up with Python packages which are stored in different location: system directories, user directories, ...
|
||||
|
||||
Assume you use Python 3 and Linux.
|
||||
|
||||
---
|
||||
|
||||
Python venv stores everything in a local directory.
|
||||
|
||||
Inside chosen directory, run:
|
||||
Creating virtual environments:
|
||||
|
||||
```sh
|
||||
python -m venv venv
|
||||
python3 -m venv /path/to/venv
|
||||
```
|
||||
|
||||
Now you can use venv with:
|
||||
Activate:
|
||||
|
||||
```sh
|
||||
# Bash
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
- [Python](Development/python/README.md)
|
||||
- [venv](Development/python/venv.md)
|
||||
- [argparse](Development/python/argparse.md)
|
||||
- [subprocess](Development/python/subprocess.md)
|
||||
- [Docker](Development/docker.md)
|
||||
- [Redis](Development/redis.md)
|
||||
- [Prometheus](Development/prometheus.md)
|
||||
|
|
Loading…
Reference in New Issue