python import module troubleshooting

用到了一个叫做munkres的库

但每次import的时候都出现了问题

后来找到问题是我自己的python file 命名为munkres.py 

所以每次它import 的时候都是import 我自己的python file 

python 这一点也挺不好的,感觉就是很随意的,interpreter一脸懵逼?

还有问题是不是很多库都是python2 和python3 共同使用的,就是没有冲突,为了验证这一点我还特意搞了python2的环境,结果是没有冲突。

Traceback (most recent call last):
  File "f:/PythonDev/benchmarks/scripts/import_munres.py", line 5, in <module>

ImportError: cannot import name 'Munkres' from 'munkres' (f:\PythonDev\benchmarks\scripts\munkres.py)

猜你喜欢

转载自blog.csdn.net/fly1ng_duck/article/details/89842988