Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/303.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/neo4j/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python pyrrd.exceptions.ExternalCommandError:/bin/sh:1:rrdtool:未找到_Python_Database_Python 2.7_Rrdtool_Rrd - Fatal编程技术网

Python pyrrd.exceptions.ExternalCommandError:/bin/sh:1:rrdtool:未找到

Python pyrrd.exceptions.ExternalCommandError:/bin/sh:1:rrdtool:未找到,python,database,python-2.7,rrdtool,rrd,Python,Database,Python 2.7,Rrdtool,Rrd,执行上述代码时,会出现此错误 from pyrrd.rrd import DataSource, RRA, RRD filename = 'test.rrd' dataSources = [] roundRobinArchives = [] dataSource = DataSource(dsName='speed', dsType='COUNTER', heartbeat=600) dataSources.append(dataSource) roundRobinArchives.append

执行上述代码时,会出现此错误

from pyrrd.rrd import DataSource, RRA, RRD
filename = 'test.rrd'
dataSources = []
roundRobinArchives = []
dataSource = DataSource(dsName='speed', dsType='COUNTER', heartbeat=600)
dataSources.append(dataSource)
roundRobinArchives.append(RRA(cf='AVERAGE', xff=0.5, steps=1, rows=24))
roundRobinArchives.append(RRA(cf='AVERAGE', xff=0.5, steps=6, rows=10))
myRRD = RRD(filename, ds=dataSources, rra=roundRobinArchives, start=920804400)
myRRD.create()
rrdtool create test.rrd--启动920804400--步骤300 DS:速度:计数器:600:U:U RRA:平均值:0.5:1:24 RRA:平均值:0.5:6:10
回溯(最近一次呼叫最后一次):
文件“test.py”,第10行,在
没药创建()
文件“build/bdist.linux-x86_64/egg/pyrrd/rrd.py”,第175行,在create中
文件“build/bdist.linux-x86_64/egg/pyrrd/backend/external.py”,第49行,在create中
文件“build/bdist.linux-x86_64/egg/pyrrd/backend/external.py”,第21行,in_cmd
pyrrd.exceptions.ExternalCommandError:/bin/sh:1:rrdtool:未找到

我是rrd工具的新手。请帮我解决这个问题。提前感谢。

您已经描述了创建rrd文件的两种不同方法:一种是通过python包pyrrd,另一种是使用命令行工具rrdtool

您不需要同时使用这两种脚本——如果您想使用python脚本创建文件,只需像常规脚本一样运行它

当您使用apt-get(在ubuntu上)下载pyrrd时,它还下载cmd工具,而如果您使用pip下载它,它只下载python包

由于在我的环境中使用了您的代码(没有特殊的PYTHONPATH配置),我假设您有一些安装问题,请尝试重新安装,或者单独安装cmd工具

rrdtool create test.rrd --start 920804400 --step 300   DS:speed:COUNTER:600:U:U RRA:AVERAGE:0.5:1:24 RRA:AVERAGE:0.5:6:10
Traceback (most recent call last):
File "test.py", line 10, in <module>
 myRRD.create()
File "build/bdist.linux-x86_64/egg/pyrrd/rrd.py", line 175, in create
File "build/bdist.linux-x86_64/egg/pyrrd/backend/external.py", line 49, in create
File "build/bdist.linux-x86_64/egg/pyrrd/backend/external.py", line 21, in _cmd
pyrrd.exceptions.ExternalCommandError: /bin/sh: 1: rrdtool: not found