LoginSignup
7
2

More than 3 years have passed since last update.

pipreqsがUnicodeDecodeErrorになるときの対処法

Last updated at Posted at 2020-05-22

pipreqsとは

pythonの外部モジュールを使用した際のrequirements.txtを自動で書きだしてくれる奴。
プロジェクトフォルダ/hoge.pyとなっているときに、

cd プロジェクトフォルダ
pipreqs .

でhoge.pyのrequirements.txtがプロジェクトフォルダ以下に出るはずだったのが、

UnicodeDecodeError: 'cp932' codec can't decode byte 0x81 in position 239: illegal multibyte sequence

エンコードわかんねーぞでよく出るエラーが出た。

リファレンスを読む。
https://pypi.org/project/pipreqs/
--encodingオプションがあるらしい。

解決コマンド

pipreqs --encoding UTF8 .

これで解決。

requirements.txt
networkx==2.3
plotly==4.4.1
pandas==1.0.3
streamlit==0.60.0

無事に出てきました、おしまい。

7
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
2