<分区>
我正在尝试从 Python 中修改父 shell 上的环境变量。到目前为止我所做的尝试没有奏效:
~ $ export TESTING=test
~ $ echo $TESTING
test
~ $
~ $
~ $ python
Python 2.7.10 (default, Jun 1 2015, 18:05:38)
[GCC 4.9.2] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.environ['TESTING']
'test'
>>> os.environ['TESTING'] = 'changed'
>>> os.environ['TESTING']
'changed'
>>> quit()
~ $
~ $
~ $ echo $TESTING
test
这就是我所能想到的。可以吗? Python如何设置父shell的环境变量?