我试图使用VSCode在本地运行python函数,但它几乎立即关闭了自己。
在本教程之后,我创建了最简单的示例函数,但我相信我的机器上的配置有问题。
在启动该函数之后,我几乎立即看到以下内容
[9/1/2019 4:52:07 PM] Found the following functions:
[9/1/2019 4:52:07 PM] Host.Functions.HttpTriggerTest
[9/1/2019 4:52:07 PM]
[9/1/2019 4:52:07 PM] Host initialized (573ms)
[9/1/2019 4:52:07 PM] Host started (590ms)
[9/1/2019 4:52:07 PM] Job host started
[9/1/2019 4:52:07 PM] python: can't open file 'C:\Users\First': [Errno 2] No such file or directory
[9/1/2019 4:52:07 PM] python: can't open file 'C:\Users\First': [Errno 2] No such file or directory
[9/1/2019 4:52:07 PM] Starting language worker process:python C:\Users\First Last\.vscode\extensions\ms-python.python-2019.3.6558\pythonFiles\ptvsd_launcher.py --default --host 127.0.0.1 --port 9091 --wait "C:\Users\First
Last\AppData\Roaming\npm\node_modules\azure-functions-core-tools\bin\workers\python\worker.py" --host 127.0.0.1 --port 64975 --workerId e9dc059f-128f-4e11-8363-797b4f1eeb1b --requestId c857107a-6b99-4d5a-9b71-d27827bfcad3 --grpcMaxMessageLength 134217728
[9/1/2019 4:52:07 PM] python process with Id=20920 started
Hosting environment: Production
Content root path: C:\file_location\Dev\PythonDev\MyAzureFunctions
Now listening on: http://0.0.0.0:7071
Application started. Press Ctrl+C to shut down.
Http Functions:
HttpTriggerTest: [GET,POST] http://localhost:7071/api/HttpTriggerTest
[9/1/2019 4:52:07 PM] python: can't open file 'C:\Users\First': [Errno 2] No such file or directory
[9/1/2019 4:52:07 PM] Exceeded language worker restart retry count for runtime:python. Shutting down Functions Host
[9/1/2019 4:52:07 PM] Stopping host...
[9/1/2019 4:52:07 PM] Stopping JobHost
[9/1/2019 4:52:07 PM] Job host stopped
[9/1/2019 4:52:07 PM] Host shutdown completed.
Application is shutting down...注意:错误消息提示文件C:\Users\First不能打开,因为它不存在。它确实不存在。真正存在的是一个名为"C:\Users\First“的文件夹。也许我的windows用户名中的空间引起了问题?
发布于 2019-09-02 09:02:11
实际上,这是因为您将目录放在单引号''中,需要将它们放在双引号""中。即"C:\Program Files\Python 3.4\python.exe"
如果这不是关键问题,请分享一些导致问题的代码。
发布于 2019-09-02 04:46:20
这是早期版本的python的一个问题。
在执行以下操作时,请确保以管理员身份运行teminals或vscode
3.6.8,则必须卸载旧版本并从这里下载最新版本。azure-functions-core-tools?
即使在安装了最新版本的python之后,如果您的问题没有得到解决,->也尝试卸载它,然后reboot您的机器->然后执行npm install -g azure-functions-core-toolshttps://stackoverflow.com/questions/57748653
复制相似问题