Microsoft Power Automate中的Python 2.7的作用就像未安装JSON

发布于 2025-01-28 07:25:09 字数 707 浏览 3 评论 0原文

我正在尝试在Microsoft Power Automate桌面上运行一些Python代码。我知道PAD只能运行Python 2.7版或更早版本。我已经在命令行中测试了代码,它似乎使用Python 2.7工作。在命令行中键入“ py -2.7 codename.py”似乎成功地运行了代码,但是将相同的代码放入pad中的“运行python脚本”操作中产生以下scripterror:

''''''' Trackback(最近的最新电话): 文件“”,第2行,在 文件“ c:\ python27 \ lib \ site- packages \ jwt_ init _。py',第19行,in 文件“ c:\ python27 \ lib \ site-packages \ jwt \ api_jwt.py”, 第1行,英寸 Importerror:没有名为JSON的模块 '''

api_jwt.py第1行只是'导入json',应包含在Python 2.7中。我尝试将JSON添加到Python 2.7安装:

键入: ''' C:\ py -2.7 -m PIP安装JSON ''' 在命令行中产生以下错误:

错误:找不到满足要求JSON的版本(来自版本:无) 错误:找不到JSON的匹配分布

,并在堆栈上搜索类似的问题溢出的答案都表明应该已经安装了JSON。

是否可以手动将JSON添加到Python 2.7,或验证是否已添加,或者在Power Automate桌面中解决问题?

I'm trying to run some Python code in Microsoft Power Automate Desktop. I'm aware that PAD will only run Python version 2.7 or earlier. I have tested the code in the command line and it appears to work using Python 2.7. Typing 'py -2.7 CodeName.py' in the command line appears to run the code successfully, but putting that same code into the 'Run Python Script' action in PAD yields the following ScriptError:

'''
Traceback (most recent call last):
File "", line 2, in
File "C:\Python27\Lib\site-
packages\jwt_init_.py", line 19, in
File "C:\Python27\Lib\site-packages\jwt\api_jwt.py",
line 1, in
ImportError: No module named json
'''

api_jwt.py line 1 is simply 'Import json', which should be included in Python 2.7. My attempts to add json to my Python 2.7 install:

Typing:
'''
C:\py -2.7 -m pip install json
'''
In the command line yields the following error:

ERROR: Could not find a version that satisfies the requirement json (from versions: none)
ERROR: No matching distribution found for json

And searching similar questions on stack overflow the answers all indicate json should already be installed.

Is it possible to add json to Python 2.7 manually, or verify that it's been added, or otherwise fix the issue within Power Automate Desktop?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

千秋岁 2025-02-04 07:25:09

https://www.youtube.com/www.youtube.com/watch?v=ggkcusrqsassrqsasasump; am AB_CHANNEL = MR.BALBESINA

解决方案是通过将通往Python.exe的路径定义为变量和通往我的Python脚本的路径,然后在Power Automate台式机内将Python 3.9致电Python 3.9,然后运行以下PowerShell代码:

%pathpython%%pathscript%

https://www.youtube.com/watch?v=gGKCuSrqsas&ab_channel=mr.balbesina

The solution was to call python 3.9 within Powershell within Power Automate Desktop by defining the path to python.exe as a variable and the path to my python script as a variable, then running the following PowerShell code:

%pathPython% %pathScript%

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文