在jupyter笔记本中运行时,subprocess命令失败

时间:2019-04-01 19:58:54

标签: python subprocess jupyter

这在解释器中有效

unordered_map<BSTR>

但是如果我将其放在jupyter的单元格中,我会得到:

python
Python 2.7.15rc1 (default, Nov 12 2018, 14:31:15) 
[GCC 7.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import subprocess
>>> subprocess.call(["sudo", "apt", "update"])
[sudo] password for stefan: 
Get:1 file:/var/cuda-repo-10-1-local-10.1.105-418.39  InRelease
Ign:1 file:/var/cuda-repo-10-1-local-10.1.105-418.39  InRelease
.
.
.
etched 2,778 kB in 1s (2,305 kB/s)                                                  
Reading package lists... Done
Building dependency tree       
Reading state information... Done
12 packages can be upgraded. Run 'apt list --upgradable' to see them.
0
>>> exit()

0 个答案:

没有答案