OSError:使用python sh的pty设备不足

OSError:使用python sh的pty设备不足,python,python-2.7,Python,Python 2.7,我正在chroot环境中运行pyinstaller二进制文件。下面的代码生成一个回溯 from sh import ps, grep grep(ps('-ef'), '[p]rovision_storage.py', _tty_in=True) File "sh.py", line 1427, in call File "sh.py", line 767, in init File "sh.py", line 1780, in init File "pty.py", line 29,

我正在chroot环境中运行pyinstaller二进制文件。下面的代码生成一个回溯

from sh import ps, grep
    grep(ps('-ef'), '[p]rovision_storage.py', _tty_in=True)

File "sh.py", line 1427, in call
File "sh.py", line 767, in init
File "sh.py", line 1780, in init
File "pty.py", line 29, in openpty
File "pty.py", line 70, in _open_terminal
OSError: out of pty devices
_设置为False的tty_也会产生相同的回溯

from sh import ps, grep
    grep(ps('-ef'), '[p]rovision_storage.py', _tty_in=True)

File "sh.py", line 1427, in call
File "sh.py", line 767, in init
File "sh.py", line 1780, in init
File "pty.py", line 29, in openpty
File "pty.py", line 70, in _open_terminal
OSError: out of pty devices
环境:使用Python 2.7.13编译的Pyinstaller二进制文件
编译/运行chroot OS:Debian Stretch

只需将devpts设备装载到chroot环境中:

# mount --bind /dev /path/to/chroot/dev
# mount -t devpts none /path/to/chroot/dev/pts