我试图在MATLAB的系统命令中使用“whichpython3”,但它不起作用。这里的目标是编写一个脚本,该脚本可以运行特定版本的python,而无需将路径硬编码到脚本中。我希望脚本找到python3,然后按完整路径名调用它
当我在MATLAB中运行以下命令时
>> [stat, result] = system('which python3')
我得到以下输出:
stat =
1
result =
0x0 empty char array
但是,我可以在UNIX中运行以下命令并获得良好的结果:
$ which python3
/usr/local/bin/python3
此外,这在MATLAB中工作良好:
>> [stat, result] = system('which python')
stat =
0
result =
'/usr/bin/python
'
在UNIX中
$ which python
/usr/bin/python
我得到了some help on this one from the "MATLAB Answers" forum。用户Walter Robertson告诉我
因此,我的登录脚本没有运行,因此Python 3的路径没有包含在MATLAB系统运行which命令的上下文中,因此我从系统中得到一个空结果
相关问题 更多 >
编程相关推荐