简体   繁体   English

import graphviz 在 jupyter notebook 中有效,但相同的代码在 Pycharm 中无效

[英]import graphviz works in jupyter notebook, but the same code does not work in Pycharm

import graphviz works in jupyter notebook, but the same code does not work in Pycharm. import graphviz 在 jupyter notebook 中有效,但相同的代码在 Pycharm 中无效。 I tried to setup an anaconda environment which includes graphviz and I am using that particular python interpreter from pycharm.我尝试设置一个包含 graphviz 的 anaconda 环境,并且我正在使用来自 pycharm 的特定 python 解释器。 I am stuck with this problems for last 24 hours, please help..?我在过去 24 小时内都遇到了这个问题,请帮忙..? 在此处输入图像描述

在此处输入图像描述

Try creating a new project, than choose "Previously configured interpreter".尝试创建一个新项目,而不是选择“以前配置的解释器”。 Check if the Python exe within the correct enviroment is selected.检查是否选择了正确环境中的 Python exe。 So in "Users/UserName/anaconda3/envs/Python/python.exe".所以在“用户/用户名/anaconda3/envs/Python/python.exe”中。 Than when the new project is created you can check in the terminal if the correct env is enabled by looking for the term in the brackets.比创建新项目时,您可以通过查找括号中的术语来检查终端是否启用了正确的环境。 (Should by "Python" for you). (应该由“Python”为你)。 Than try to import graphviz in the Python Console.比尝试在 Python 控制台中导入 graphviz。 If this works your file has a wrong configuration.如果这可行,则您的文件配置错误。 Copy it in the new project and add the correct Configuration.将其复制到新项目中并添加正确的配置。 Tried this and it works for me.试过这个,它对我有用。 Hope I could help and good luck.希望我能帮上忙,祝你好运。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM