0

我尝试从 python 脚本设置 ORACLE_HOME 路径如下,但它不起作用,知道如何设置它吗?

>>> subprocess.call(["export", "ORACLE_HOME="+ORACLE_HOME], env= os.environ)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib64/python2.4/subprocess.py", line 419, in call
    return Popen(*args, **kwargs).wait()
  File "/usr/lib64/python2.4/subprocess.py", line 550, in __init__
    errread, errwrite)
  File "/usr/lib64/python2.4/subprocess.py", line 996, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory
>>> subprocess.call(["export", "ORACLE_HOME="+ORACLE_HOME])
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib64/python2.4/subprocess.py", line 419, in call
    return Popen(*args, **kwargs).wait()
  File "/usr/lib64/python2.4/subprocess.py", line 550, in __init__
    errread, errwrite)
  File "/usr/lib64/python2.4/subprocess.py", line 996, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory
4

1 回答 1

1

使用os.environ

os.environ['ORACLE_HOME'] = 'whatever'
于 2013-10-24T09:37:45.510 回答