python中config命令_'python-config' 不是内部或外部命令,也不是可运行的程序

python已经安装了,python-config命令是什么

C:\Users\Administrator\AppData\Roaming\npm\node_modules\python.js>if not defined

npm_config_node_gyp (node "D:\Program Files\nodejs\node_modules\npm\bin\node-gy

p-bin....\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node rebui

ld )

'python-config' 不是内部或外部命令,也不是可运行的程序

或批处理文件。

gyp: Call to 'python-config --libs' returned exit status 1. while trying to load

binding.gyp

gyp ERR! configure error

gyp ERR! stack Error: gyp failed with exit code: 1

gyp ERR! stack at ChildProcess.onCpExit (D:\Program Files\nodejs\node_module

s\npm\node_modules\node-gyp\lib\configure.js:355:16)

gyp ERR! stack at ChildProcess.emit (events.js:110:17)

gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:1074

:12)

gyp ERR! System Windows_NT 6.1.7601

gyp ERR! command "node" "D:\Program Files\nodejs\node_modules\npm\node_modu

les\node-gyp\bin\node-gyp.js" "rebuild"

gyp ERR! cwd C:\Users\Administrator\AppData\Roaming\npm\node_modules\python.js

gyp ERR! node -v v0.12.7

gyp ERR! node-gyp -v v2.0.1

gyp ERR! not ok

npm ERR! Windows_NT 6.1.7601

npm ERR! argv "D:\Program Files\nodejs\node.exe" "D:\Program Files\nodejs

\node_modules\npm\bin\npm-cli.js" "install" "python.js" "-g"

npm ERR! node v0.12.7

npm ERR! npm v2.11.3

npm ERR! code ELIFECYCLE

npm ERR! python.js@0.5.0 install: node-gyp rebuild

npm ERR! Exit status 1

npm ERR!

npm ERR! Failed at the python.js@0.5.0 install script 'node-gyp rebuild'.

npm ERR! This is most likely a problem with the python.js package,

npm ERR! not with npm itself.

npm ERR! Tell the author that this fails on your system:

npm ERR! node-gyp rebuild

npm ERR! You can get their info via:

npm ERR! npm owner ls python.js

npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:

npm ERR! C:\Users\Administrator\npm-debug.log

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
ConfigArgParse是Python的一个命令行参数解析模块,它支持从多个来源(命令行参数、配置文件、环境变量等)读取参数,并且提供了一些额外的功能,如默认值、类型转换、互斥参数等。 它的使用方式类似于Python自带的argparse模块,但是提供了更加灵活的参数读取方式。同时,ConfigArgParse也支持将参数值保存到配置文件,方便下次使用时直接读取。 以下是一个使用ConfigArgParse模块的例子: ```python import configargparse parser = configargparse.ArgumentParser() parser.add_argument('--input', type=str, help='input file path') parser.add_argument('--output', type=str, help='output file path') parser.add_argument('--num_iters', type=int, default=10, help='number of iterations') parser.add_argument('--batch_size', type=int, default=32, help='batch size') args = parser.parse_args() print(args.input) print(args.output) print(args.num_iters) print(args.batch_size) ``` 在上述例子,我们使用了configargparse.ArgumentParser()创建了一个解析器对象,并通过add_argument()方法添加了四个参数。其,--input和--output是必选参数,--num_iters和--batch_size是可选参数,如果不指定则会使用默认值。 通过parser.parse_args()方法解析命令行参数,可以从命令行读取参数值来覆盖默认值。例如,运行以下命令: ```bash python example.py --input data.txt --num_iters 20 ``` 则会输出: ``` data.txt None 20 32 ``` 其,--input参数的值被设为了"data.txt",--num_iters参数的值被设为了20,而--output参数没有指定,因此其值为None。 除了从命令行读取参数外,ConfigArgParse还支持从配置文件、环境变量、文件等多个来源读取参数。例如,可以在当前目录下创建一个config.ini文件,写入以下内容: ```ini [input] path = data.txt [output] path = result.txt [num_iters] value = 30 [batch_size] value = 64 ``` 然后,在命令使用以下命令运行脚本: ```bash python example.py --config-file config.ini ``` 则会从配置文件读取参数值,并覆盖默认值。例如,在上述例子,--input参数的默认值被覆盖为了"data.txt",而--num_iters参数的默认值被覆盖为了30。 ConfigArgParse还支持其他一些高级功能,如互斥参数、子命令等,可以根据实际需求进行使用。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值