我正在使用mac x,并试图设置pycallgraph。
我用pip安装了pycallgraph,并用自制软件安装了graphviz。
一切都是从壳开始运作的。但不是来自侏儒。
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/ ->虚拟环境
/Users/user/Projects/py27_django/ ->项目dir
它想要我做什么?
发布于 2013-12-02 18:31:45
答案是:
在半月板:
Pycharm -> Run -> Edit Configurations...
在对话框中:
对于选定的.py文件或默认值/Python:
环境场组:
Environment variables > ... -> + ->
添加条目:
名称:PATH
价值:/usr/local/bin
应该选择Include print environment variables
发布于 2014-06-02 04:05:01
使用以下方法在图形中安装MacOS:
brew install graphviz
或在Ubuntu中使用:
sudo apt-get install graphviz
然后,您可以使用以下方法测试点:
dot -v
您也可以从这里下载pkg。
发布于 2016-08-22 11:41:11
FWIW,这是另外两个用户在PyCharm的bugtracker中作为问题提交的行为:https://youtrack.jetbrains.com/issue/PY-17816
如果开发者有评论的话,我会更新这篇文章。
2016年9月22日更新,Pycharm开发人员在早期访问版本中提供了一个修复程序。https://blog.jetbrains.com/pycharm/2016/09/pycharm-2016-3-eap-is-available-with-initial-support-for-python-3-6/,但这似乎还没有解决问题。
https://stackoverflow.com/questions/20333530
复制相似问题