为什么curl无法通过python工作但在命令提示符下工作正常?

时间:2019-06-24 08:53:48

标签: python curl subprocess

curl www.google.com可以在命令提示符下运行,但是当我尝试将其放入python时,会出现以下错误:'curl' is not recognized as an internal or external command, operable program or batch file.

我尝试同时使用subprocess.call和os.system都给出相同的错误

from subprocess import call
import os
os.system('curl www.google.com')
call('curl www.google.com',shell=True)

我正在使用Windows 10专业版

1 个答案:

答案 0 :(得分:0)

回答我自己的问题。

cURL预先安装在Windows中。 通过将cURL重新安装到新位置并在环境变量中添加路径,我能够使其工作。

相关问题