首页 > 解决方案 > 如何在 Python 中使用命令行运行可执行文件?

问题描述

我已经安装了这个包:https ://github.com/retostauffer/PyGFSV2 ,带有 pip。该软件包带有两个可执行文件(GFSV2_get 和 GFSV2_bulk)。但是,我不知道如何在 Python 中打开可执行文件。

因此,安装后,包作者建议通过调用尝试安装:

GFSV2_get --step 12 24 --level 700 850 --param tmp_pres --date 2005-01-01

所以,我输入了 Anaconda Prompt 下一个:

(base) C:\Users\vrida>CD C:\Users\vrida\anaconda3\Scripts

(base) C:\Users\vrida\anaconda3\Scripts>python GFSV2_get --step 12 24 --level 700 850 --param tmp_pres --date 2005-01-01

但是,它没有用。出现这个:

# DEBUG Loading default config file from package source.
# INFO Config file read, return.
# INFO Processing date 2005-01-01 00Z
# INFO Downloading inventory information data
# DEBUG Reading ftp://ftp.cdc.noaa.gov/Projects/Reforecast2/2005/200501/2005010100/mean/latlon\tmp_pres_2005010100_mean.grib2.inv
# ERROR Problems reading file, reason: "ftp error: URLError("ftp error: error_perm('550 Failed to change directory.')")".
# ERROR Could not download inventory file! Skip this.
# INFO Inventory empty, skip this file
# INFO Downloading inventory information data
# DEBUG Reading ftp://ftp.cdc.noaa.gov/Projects/Reforecast2/2005/200501/2005010100/sprd/latlon\tmp_pres_2005010100_sprd.grib2.inv
# ERROR Problems reading file, reason: "ftp error: URLError("ftp error: error_perm('550 Failed to change directory.')")".
# ERROR Could not download inventory file! Skip this.
# INFO Inventory empty, skip this file

我是 Python 的初学者。所以我有两个问题:

1 - 如何运行这些可执行文件,例如使用 Anaconda Prompt?

2 - 任何人都可以在尝试安装后下载软件包,如果成功,请告诉我如何制作相同的?

标签: pythongithubanacondaexecutable

解决方案


我认为你应该联系包的维护者。显然,图书馆试图通过 ftp 下载一些文件,使用系统文件分隔符 \ 在你的情况下(因为你使用的是 Windows),而不是 /:ftp://ftp.cdc.noaa.gov/Projects/Reforecast2/2005 /200501/2005010100/mean/latlon \tmp_pres_2005010100_mean.grib2.inv

可以使用标准 ftp 客户端通过匿名 ftp 访问来访问该文件。所以这应该是python库的问题。


推荐阅读