美文网首页
PythonError

PythonError

作者: _sunnyRain | 来源:发表于2018-05-21 19:14 被阅读0次

    错误:

    IndentationError: expected an indented block

    解决:

    you have an indentation error. It is probably caused by a mix of tabs and spaces.

    格式不对,没有按tab键。


    错误:

    解决:

    在路径前加个r


    错误:

    NameError: name 'raw_input' is not defined

    解决:

    python3用input()


    错误:

    unboundlocalerror: local variable 'os' referenced before assignment

    解决:

    。。。


    错误:

    ModuleNotFoundError: No module named 'gensim'

    解决:

    安装gensim

    错误:

    AttributeError: 'dict' object has no attribute 'iteritems'

    解决:

    python中属性问题

    错误:

    AttributeError: module 'numpy' has no attribute 'exe'

    解决:

    np.exe()打错,应该为np.exp()


    错误:

    UnicodeDecodeError

    UnicodeDecodeError: 'gbk' codec can't decode byte 0x80 in position 4: illegal multibyte sequence

    解决1:

    对所有open(stop_word_path)中加上open(stop_word_path,'r',encoding='UTF-8')

    解决2:

    改成open(stop_word_path,'rb')


    问题:

    ModuleNotFoundError

    ModuleNotFoundError: No module named 'urllib2'

    解决:

    python3中应为urllib.request


    问题:

    AttributeError

    AttributeError: 'str' object has no attribute 'decode'

    解决:

    去掉  .decode('utf-8')  部分


    问题:

    OSError

    OSError: [Errno 22] Invalid argument: 'D:\\PyCharm\\Projects\\medical-entity-recognition-master\train_test_data\train_bio_word.txt'

    解决:

    改成open(r"C:\description_files\program_description.txt","r")

    或open("program_description.txt","r")

    相关文章

      网友评论

          本文标题:PythonError

          本文链接:https://www.haomeiwen.com/subject/diyqjftx.html