You can using SETX at the command-line.
By default these actions go on the USER env vars.
To set and modify SYSTEM vars use the /M flag
import os
env_var = "BUILD_NUMBER"
env_val = "3.1.3.3.7"
os.system("SETX {0} {1} /M".format(env_var,env_val))
More Related Contents:
- How to add to the PYTHONPATH in Windows, so it finds my modules/packages?
- How to set environment variables in Python?
- Environment variable differences when using Paramiko
- “ImportError: No module named site” on Windows
- How to set environment variables in PyCharm?
- setting an environment variable in virtualenv
- Python: Platform independent way to modify PATH environment variable
- How to use Jupyter notebooks in a conda environment?
- How to set env variable in Jupyter notebook
- Disable assertions in Python
- Securely storing environment variables in GAE with app.yaml
- Does `anaconda` create a separate PYTHONPATH variable for each new environment?
- When to use sys.path.append and when modifying %PYTHONPATH% is enough
- In Python script, how do I set PYTHONPATH?
- nltk doesn’t add $NLTK_DATA to search path?
- Tensorflow set CUDA_VISIBLE_DEVICES within jupyter
- Reading and writing environment variables in Python? [duplicate]
- What is the use of python-dotenv?
- Set LD_LIBRARY_PATH before importing in python
- How can I access environment variables in Python?
- Launch Pycharm from command line (terminal)
- Environment Variables when script run by cron
- How to get the PATH environment-variable separator in Python?
- How to enable a virtualenv in a systemd service unit?
- Loading environment modules within a python script
- How to access environment secrets from a Github workflow?
- Is it possible to set an environment variable from Python permanently?
- Bundling Data files with PyInstaller 2.1 and MEIPASS error –onefile
- How to evaluate environment variables into a string in Python?
- Change current process environment’s LD_LIBRARY_PATH