如何在Python中运行已下载的存储库配置?

2024-04-27 05:57:46 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试使用SunnyPy。我对python比较陌生,不了解自述文件中的第2步:

如何运行

  1. 克隆或下载存储库
  2. 输入目录并运行: PYTHONPATH=. ./bin/sunnyportal2pvoutput --dry-run sunnyportal.config
  3. 输入请求的信息,并验证脚本是否能够连接到Sunny Portal
  4. 该信息保存在sunnyportal.config中,如果键入错误,可以编辑/删除
  5. 工作后,将--dry run替换为--output以将过去七天的输出数据上载到pvoutput,或将--status替换为上载当天的数据
  6. Add--quiet使输出静音

有人能帮我吗?我已进入下载文件夹中的cmd.exe,我不知道如何在正确位置正确写入python路径。我应该将什么粘贴到命令行中?谢谢

编辑:我想能够在Windows上这样做,请告诉我这是否可行


Tags: 数据run目录脚本信息config编辑bin
1条回答
网友
1楼 · 发布于 2024-04-27 05:57:46

bullet 2中的命令将在命令行中键入(您需要在windows:cmd或powershell、Linux:bash等中才能执行此操作)

PYTHONPATH=. ./bin/sunnyportal2pvoutput dry-run sunnyportal.config

上面命令代码的第一部分指示程序的位置。通过命令行(windows:cd:…;其中..是您的文件夹名)转到特定文件夹并键入命令

第二部分是要执行的命令。在“破折号”后面。程序知道该做什么。在这种情况下:

dry-run sunnyportal.config

运行验证/配置文件,查看程序代码本身是否工作;如“干运行”所示

在您的案例中,在位置键入(在cmd中):

"sunnyportal2pvoutput dry-run sunnyportal.config"

"sunnyportal2pvoutput.py dry-run sunnyportal.config" (without the environment variables (python path) set).

注意:pythonpath是一个环境变量。可通过以下方式添加:控制面板\所有控制面板项目\系统\>;bullet高级系统设置>;按钮“环境变量”。然后,您可以选择将其添加到“用户用户名变量”或“系统变量”中。请记住此后重新启动以使更改立即生效

更新1(pip安装sunnyportal):

  1. 转到cmd
  2. 键入“pip搜索阳光门户”

结果:

Microsoft Windows [Version 10.0.18363.836] (c) 2019 Microsoft Corporation. All rights reserved. C:\Windows\System32>pip search sunnyportal

sunnyportal-py (0.0.4) - A Python client for SMA sunny portal

C:\Windows\System32>

如果找到,则键入:

“pip安装sunnyportal”

相关问题 更多 >