LoginSignup
1
0

More than 3 years have passed since last update.

[python]ライブラリramkanのインストールでエラーになる

Posted at

ramkanはローマ字/仮名変換用のライブラリ。
インストールする際にエラーが起きたので忘備録。

エラー内容

ramkanのインストール

$ pip3 install romkan

するとこういうエラーが起きる。

Collecting romkan==0.2.1
  Downloading romkan-0.2.1.tar.gz (10 kB)
    ERROR: Command errored out with exit status 1:
     command: /home/scaruadmin/venv/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-8y_m14tz/romkan_f9a5712add8043608044b16dab0fc01c/setup.py'"'"'; __file__='"'"'/tmp/pip-install-8y_m14tz/romkan_f9a5712add8043608044b16dab0fc01c/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-xw46by6f
         cwd: /tmp/pip-install-8y_m14tz/romkan_f9a5712add8043608044b16dab0fc01c/
    Complete output (7 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-8y_m14tz/romkan_f9a5712add8043608044b16dab0fc01c/setup.py", line 12, in <module>
        README = open(os.path.join(here, 'README.rst')).read()
      File "/opt/rh/rh-python36/root/usr/lib64/python3.6/encodings/ascii.py", line 26, in decode
        return codecs.ascii_decode(input, self.errors)[0]
    UnicodeDecodeError: 'ascii' codec can't decode byte 0xe3 in position 181: ordinal not in range(128)
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

解決策

pythonの言語設定が問題っぽい。

$ sudo vim ~/.bashrc

ファイルに↓を追加して保存。

export LC_ALL=en_US.UTF-8

bashの再起動

$source ~/.bashrc

おしまい

参考

PythonのUnicodeDecodeErrorの対処方法 - Python入門

前提知識など
.bash_profileと.bashrcのまとめ - Qiita
よく使う Vim のコマンドまとめ - Qiita

追記

Docker使ってる場合は、bashの設定じゃなくてdockerに言語設定してもいいかもしれない。
Docker: コンテナのlocaleを設定したい - Qiita

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