Pipreqs: UnicodeDecodeError: 'charmap' codec can't decode byte 0x98 in position 1206: character maps to <undefined>
Pipreqs: UnicodeDecodeError: 'charmap' codec can't decode byte 0x98 in position 1206: character maps to <undefined>
当我使用pipreqs
时,我遇到了这个问题。我使用 anaconda 和俄语 Windows.
root@DESKTOP-ETLLRI1 C:\Users\root\Desktop\resumes
$ pipreqs C:\Users\root\Desktop\resumes
Traceback (most recent call last):
File "C:\Users\root\Anaconda3\Scripts\pipreqs-script.py", line 9, in <module>
sys.exit(main())
File "C:\Users\root\Anaconda3\lib\site-packages\pipreqs\pipreqs.py", line 396, in main
init(args)
File "C:\Users\root\Anaconda3\lib\site-packages\pipreqs\pipreqs.py", line 341, in init
extra_ignore_dirs=extra_ignore_dirs)
File "C:\Users\root\Anaconda3\lib\site-packages\pipreqs\pipreqs.py", line 75, in get_all_imports
contents = f.read()
File "C:\Users\root\Anaconda3\lib\encodings\cp1251.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x98 in position 1206: character maps to <undefined>
您可以将编码参数传递给 pipreqs
以设置用于打开文件的编码。
Python3个文件是usually encoded as utf-8,所以执行
pipreqs --encoding=utf8 C:\Users\root\Desktop\resumes
当我使用pipreqs
时,我遇到了这个问题。我使用 anaconda 和俄语 Windows.
root@DESKTOP-ETLLRI1 C:\Users\root\Desktop\resumes
$ pipreqs C:\Users\root\Desktop\resumes
Traceback (most recent call last):
File "C:\Users\root\Anaconda3\Scripts\pipreqs-script.py", line 9, in <module>
sys.exit(main())
File "C:\Users\root\Anaconda3\lib\site-packages\pipreqs\pipreqs.py", line 396, in main
init(args)
File "C:\Users\root\Anaconda3\lib\site-packages\pipreqs\pipreqs.py", line 341, in init
extra_ignore_dirs=extra_ignore_dirs)
File "C:\Users\root\Anaconda3\lib\site-packages\pipreqs\pipreqs.py", line 75, in get_all_imports
contents = f.read()
File "C:\Users\root\Anaconda3\lib\encodings\cp1251.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x98 in position 1206: character maps to <undefined>
您可以将编码参数传递给 pipreqs
以设置用于打开文件的编码。
Python3个文件是usually encoded as utf-8,所以执行
pipreqs --encoding=utf8 C:\Users\root\Desktop\resumes