最近遇到的几个python问题汇总

版权声明:旨在学习交流,共同进步 https://blog.csdn.net/u013735511/article/details/79231292

1.查看matplot等一些命令的版本方式

python中的版本是一个很重要的东西,因为低版本向高版本几乎完全不兼容,高版本向低版本也几乎是不兼容的样子。不知道python开发团队在想什么,哈哈。

在网上查找的第一个方式如下

python -c "import matplotlib; print matplotlib.version"

Traceback (most recent call last): File “”, line 1, in AttributeError: ‘module’ object has no attribute ‘version’

后来换成

[machine@localhost ~]$ python -c "import matplotlib; print matplotlib.__version__"
2.1.0

就是酱紫,其中各模块可以随机更换。

2.jupyter notebook的开启问题

[C 04:15:02.265 NotebookApp] Bad config encountered during initialization:
[C 04:15:02.265 NotebookApp] The 'contents_manager_class' trait of <notebook.notebookapp.NotebookApp object at 0x7f386c714410> instance must be a type, but 'notedown.NotedownContentsManager' could not be imported

解决的方式是安装notedown,这个来源于https://discuss.gluon.ai/t/topic/237/3

pip install notedown

然后就没问题了

3.TypeError: ‘float’ object cannot be interpreted as an index

在运行FastMaskRCNN的时候碰到了这个问题,把numpy的版本由1.12.0降为1.11.0问题得以解决。

pip install -U numpy==1.11.0

参考:http://blog.csdn.net/u011148366/article/details/66478356?utm_source=itdadao&utm_medium=referral

之后遇到问题再append

猜你喜欢

转载自blog.csdn.net/u013735511/article/details/79231292
今日推荐