java调用python脚本

由于自己的电脑安装了多个版的python ,调用总是出现问题。

1.python 默认环境是aconda3.6.4

但是String[] arg=new String[] {"python", "D:\\xiangmuwendang\\twitterMyCode\\myProject\\test2.py"};

try{    

System.out.println("start");

           pr = Runtime.getRuntime().exec(arg); //改一下参数就可以用了py-3 

            in = new BufferedReader(new InputStreamReader(pr.getInputStream()));    
            String line;
            String line1=null;
            while ((line = in.readLine()) != null) { 
            line1=line;
                System.out.println(line);    

            } 

不能正常执行

2.

猜你喜欢

转载自blog.csdn.net/wuyaxi98/article/details/80262123