1

我正在使用 nipype 进行图像处理项目。我的 python 版本是 3.6,我得到了这个错误

File "D:\softwares\Annoconda3\lib\site- 
packages\nipype\interfaces\base\core.py", line 750, in run_command
  close_fds=False,
File "D:\softwares\Annoconda3\lib\subprocess.py", line 709, in __init__
  restore_signals, start_new_session)
File "D:\softwares\Annoconda3\lib\subprocess.py", line 997, in 
_execute_child
  startupinfo)
TypeError: environment can only contain strings}

以下是导致错误的代码:

def _execute_child(self, args, executable, preexec_fn, close_fds,
                pass_fds, cwd, env,
                startupinfo, creationflags, shell,
                p2cread, p2cwrite,
                c2pread, c2pwrite,
                errread, errwrite,
                unused_restore_signals, unused_start_new_session):
"""Execute program (MS Windows version)"""

assert not pass_fds, "pass_fds not supported on Windows."

if not isinstance(args, str):
    args = list2cmdline(args)

# Process startup details
if startupinfo is None:
    startupinfo = STARTUPINFO()
if -1 not in (p2cread, c2pwrite, errwrite):
    startupinfo.dwFlags |= _winapi.STARTF_USESTDHANDLES
    startupinfo.hStdInput = p2cread
    startupinfo.hStdOutput = c2pwrite
    startupinfo.hStdError = errwrite

if shell:
    startupinfo.dwFlags |= _winapi.STARTF_USESHOWWINDOW
    startupinfo.wShowWindow = _winapi.SW_HIDE
    comspec = os.environ.get("COMSPEC", "cmd.exe")
    args = '{} /c "{}"'.format (comspec, args)

# Start the process
try:
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
                                # no special security
                                None, None,
                                int(not close_fds),
                                creationflags,
                                env,
                                os.fspath(cwd) if cwd is not None else None,
                                startupinfo)

谁能帮我解决这个问题?

4

0 回答 0