subprocess.call() gives “The system cannot find the path specified.” while the file exists and can run that truly

不打扰是莪最后的温柔 提交于 2021-01-28 19:10:14

问题


why running

import subprocess


# I'm going to run another python script in anaconda script like this:
#subprocess.call("C:\\ProgramData\\Anaconda3\\Scripts\\activate.bat && python C:\test.py")
# but for simplifying the sample for here I've deleted the second part
# (in the case you didn't install python in the default path, you can replace v_activate_address with the correct address on your computer to see the result)

v_activate_address = "C:\\ProgramData\\Anaconda3\\Scripts\\activate.bat"
subprocess.call(v_activate_address)



gives. (it's not an error):

The system cannot find the path specified.

This code can run my test.py in anaconda environment truly but that line appears which is not desirable. How should I get rid of that?

[the address is correct please don't say that]

answer to @Dunes comment:

来源:https://stackoverflow.com/questions/60642839/subprocess-call-gives-the-system-cannot-find-the-path-specified-while-the-f

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!