Cygwin中的导入错误

2024-04-26 18:31:37 发布

您现在位置:Python中文网/ 问答频道 /正文

当我试图从Cygwin启动python脚本时,我得到一个导入错误,尽管我的脚本清楚地导入了必要的模块:

$ python Test_geo.py Traceback (most recent call last): File "Test_geo.py", line 8, in <module> import matplotlib.pyplot as plt ImportError: No module named matplotlib.pyplot

当我在空闲状态下运行脚本时,它是有效的。而且,当我在gitbash中运行脚本时,它是有效的。在

我已经安装了相关的Cygwin包:C:\cygwin\lib\python2.7,它包括idlelib和importlib。在

有什么问题吗?谢谢。在


Tags: 模块pytest脚本mostmatplotlib错误call
1条回答
网友
1楼 · 发布于 2024-04-26 18:31:37

在gitbash和Cygwin中,可以比较一下与python相关的环境变量的值吗?我会在每个系统中尝试:

env | grep -i python

我想您会发现Cygwin需要在.bashrc中设置一些额外的路径。在

相关问题 更多 >