Dav*_*777 6 python windows pycharm
我正在使用以下库和代码探索树图:
from dsplot.graph import Graph
graph = Graph(
{0: [1, 4, 5], 1: [3, 4], 2: [1], 3: [2, 4], 4: [], 5: []}, directed=True
)
graph.plot()
Run Code Online (Sandbox Code Playgroud)
当我运行代码时,出现以下错误:
from dsplot.graph import Graph
ModuleNotFoundError: No module named 'dsplot'
Run Code Online (Sandbox Code Playgroud)
我尝试dsplot在 PyCharm 终端上使用以下命令 pip 安装库:
pip install dsplot
Run Code Online (Sandbox Code Playgroud)
但这会导致另一个错误:
Collecting dsplot
Using cached dsplot-0.9.0-py3-none-any.whl (8.8 kB)
Collecting pygraphviz<2.0,>=1.7
Using cached pygraphviz-1.12.tar.gz (104 kB)
ERROR: Error [WinError 3] The system cannot find the path specified while executing command pip subprocess to install build dependencies
Installing build dependencies ... error
ERROR: Could not install packages due to an OSError: [WinError 3] The system cannot find the path specified
Run Code Online (Sandbox Code Playgroud)
安装库时出现此问题的原因是什么?如何解决?
看起来你还没有安装pygraphviz。
安装pygraphviz
尝试从他们的官方网站下载它,并通过单击“将 Graphviz 添加到当前用户的系统路径”确保将其添加到您的路径中。在您的终端中运行,dot -V如果它输出您的版本pygraphviz,则您应该已准备好运行pip install dsplot。
如果dot -V不返回版本:
确保在安装过程中选中此框:
如果您选中了该框,但它仍然不在您的路径中:
添加到路径后Graphviz,打开终端并再次尝试dot -V。如果返回版本,那么您应该能够运行pip install dsplot.
| 归档时间: |
|
| 查看次数: |
164 次 |
| 最近记录: |