Python os.system command not working?

こ雲淡風輕ζ 提交于 2019-12-25 02:58:43

问题


Earlier I used to code in python well, but after I formatted my computer and reinstalled the same python setup, my os.system command stopped working, as well as subprocess.Popen.


回答1:


Looks like a path issue. The only way I could reproduce that -1 error was by setting my path to nothing so that Python couldn't find cmd.exe.

Here's a link I ran across by searching for "set windows path" in stack exchange:

http://support.microsoft.com/kb/310519

It tells how to set it for Winddows XP, the procedure is pretty much the same in later versions in that you're basically setting up environment variables which are stored in the registry.



来源:https://stackoverflow.com/questions/12571738/python-os-system-command-not-working

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