System2 to call Python2 and Python3 inside R
问题 I want to execute python with R but > system2('python2', args = c('-c', 'print', 'hello'), stdout = TRUE) [1] "" prints "" instead of hello with python2. Then again > system2('python3', args = c('-c', 'print("hello")'), stdout = TRUE, stderr = TRUE) sh: -c: line 0: syntax error near unexpected token `(' sh: -c: line 0: `'python3' -c print("hello") 2>&1' character(0) attr(,"status") [1] 2 Warning message: running command ''python3' -c print("hello") 2>&1' had status 2 prints a lot of warnings.