python - 'hskip' 未被识别为内部或外部命令,
问题描述
cmd = "perl -pe 's|hskip(.*?)(cm\\|in\\|pt\\|mm\\|em)|hspace{\\1\\2}|g' %s > %s"%(input_file,
output_file)
ret = subprocess.call(cmd, shell=True)
if ret != 0:
logging.error('FAILED: %s'%cmd)
错误输出:
'hskip' is not recognized as an internal or external command,
operable program or batch file.
2021-02-21 16:39:46,454 root ERROR FAILED: perl -pe 's|hskip(.*?)(cm\|in\|pt\|mm\|em)|hspace{\1\2}|g' .\data\sample\im2latex_formulas.lst > .\data\sample\formul`as.norm.lst
2021-02-21 16:39:46,457 root INFO Jobs finished**
解决方案
如果你在 Windows 上,你应该使用双引号而不是单引号:
例如:
cmd = 'perl -pe "s|hskip|hspace|g" in.txt > out.txt'
ret = subprocess.call(cmd, shell=True)
也可以看看:
推荐阅读
- python - Pandas lookup within groupby dataframe
- powershell - Windows 10 Powershell Automation Script Issue
- php - Gutenberg Blocks:使用 `register_block_type_from_metadata()` 注册多个块会在控制台中引发错误
- cryptography - How to derive RSA key from PGP key JavaScript?
- boost - boost Spirit x3 的编译性能问题
- android - 如何在android studio的前台添加motionSensor
- javascript - 添加未版本化的 js 构建文件时,WebStorm 变得非常慢
- kubernetes - 识别持久卷声明的节点
- javascript - 在 PayPal 订单和 PayPal 订阅之间切换
- get - 如何获取 Json 格式的方法?