PythonError

2018-05-21  本文已影响0人  _sunnyRain

错误:

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")

上一篇下一篇

猜你喜欢

热点阅读