python 设置linux环境变量

来源:互联网 发布:淘宝下单微信返现 编辑:程序博客网 时间:2024/05/16 08:27

在linux上设置临时环境变量:

export PGPASSWORD = 'postgres'

若用python实现,错误的方法:

os.system("export PGPASSWORD='postgres'")

正确的方法:

os.environ['PGPASSWORD'] = 'postgres'
0 0
原创粉丝点击