LoginSignup
0
0

More than 5 years have passed since last update.

UnicodeEncodeError@python3解決のためのlocale設定法

Last updated at Posted at 2018-08-07

問題

python3のコードを実行したときにエラーが発生した。
エラーメッセージは下記の通り。

UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-12: ordinal not in rage(128)

image.png

環境

下記の通り

OS: Windows 10 Pro
バージョン: 10.0.17134 ビルド 17134

Distributor ID: Ubuntu
Description: Ubuntu 16.04.5 LTS
("$lsb_release -a"で確認)

解決策

localeを変更した

1) localeの確認
$locale

2) localeの変更
$export LC_ALL=en_US.UTF-8

参考サイト

以下の記事から情報を得ました。
東京エンジニア:python3 ‘ascii’ codec can’t encode character ‘\u3042’ in position 0: ordinal not in range(128)解決方法

0
0
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
0
0