pycallgraph with pycharm does not work(带有 pycharm 的 pycallgraph 不起作用)
问题描述
我正在使用 mac os x 并尝试设置 pycallgraph.
我已经用 pip 安装了 pycallgraph,用 homebrew 安装了 graphviz.
一切都从外壳工作.但不是来自pycharm.
I'm using mac os x and trying to setup pycallgraph.
Ive installed pycallgraph with pip and graphviz with homebrew.
Everything works from shell.
But not from pycharm.
from pycallgraph import PyCallGraph
from pycallgraph import Config
from pycallgraph import GlobbingFilter
from pycallgraph.output import GraphvizOutput
config = Config()
config.trace_filter = GlobbingFilter(exclude=[
'pycallgraph.*',
])
graphviz = GraphvizOutput(output_file='filter_exclude.png')
with PyCallGraph(output=graphviz, config=config):
def my_fun():
print "HELLO"
my_fun()
<小时>
/Users/user/Projects/py27/bin/python /Users/user/Projects/py27_django/test2.py
Traceback (most recent call last):
File "/Users/user/Projects/py27_django/test2.py", line 15, in <module>
with PyCallGraph(output=graphviz, config=config):
File "/Users/user/Projects/py27/lib/python2.7/site-packages/pycallgraph/pycallgraph.py", line 32, in __init__
self.reset()
File "/Users/user/Projects/py27/lib/python2.7/site-packages/pycallgraph/pycallgraph.py", line 53, in reset
self.prepare_output(output)
File "/Users/user/Projects/py27/lib/python2.7/site-packages/pycallgraph/pycallgraph.py", line 97, in prepare_output
output.sanity_check()
File "/Users/user/Projects/py27/lib/python2.7/site-packages/pycallgraph/output/graphviz.py", line 63, in sanity_check
self.ensure_binary(self.tool)
File "/Users/user/Projects/py27/lib/python2.7/site-packages/pycallgraph/output/output.py", line 96, in ensure_binary
'The command "{}" is required to be in your path.'.format(cmd))
pycallgraph.exceptions.PyCallGraphException: The command "dot" is required to be in your path.
Process finished with exit code 1
<小时>
这里:/Users/user/Projects/py27/
-> virtualenv 目录/Users/user/Projects/py27_django/
-> 项目目录
Here:
/Users/user/Projects/py27/
-> virtualenv dir
/Users/user/Projects/py27_django/
-> project dir
它想从我这里得到什么?
What does it want from me?
推荐答案
答案是:
在菜单栏中:Pycharm
-> 运行
-> 编辑配置...
In menubar:
Pycharm
-> Run
-> Edit Configurations...
在对话框中:
对于选定的 .py
文件或 Defaults/Python:
In dialog:
for selected .py
file or for Defaults/Python:
环境字段组:
环境变量
> ...
-> +
->
添加条目:
名称:PATH
值:/usr/local/bin
应选择包含打印环境变量
这篇关于带有 pycharm 的 pycallgraph 不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:带有 pycharm 的 pycallgraph 不起作用


基础教程推荐
- 比较两个文本文件以找出差异并将它们输出到新的文本文件 2022-01-01
- Python,确定字符串是否应转换为 Int 或 Float 2022-01-01
- 在 Python 中将货币解析为数字 2022-01-01
- 对多索引数据帧的列进行排序 2022-01-01
- 究竟什么是“容器"?在蟒蛇?(以及所有的 python 容器类型是什么?) 2022-01-01
- 在 Django Admin 中使用内联 OneToOneField 2022-01-01
- Kivy 使用 opencv.调整图像大小 2022-01-01
- kivy 应用程序中的一个简单网页作为小部件 2022-01-01
- matplotlib 设置 yaxis 标签大小 2022-01-01
- Python 中是否有任何支持将长字符串转储为块文字或折叠块的 yaml 库? 2022-01-01