現象
Windows で pip を使って ghp-import をインストールしようとすると、以下のエラーが出ます。
>pip install ghp-import
Downloading/unpacking ghp-import
Downloading ghp-import-0.4.1.tar.gz
Running setup.py egg_info for package ghp-import
Cleaning up...
Exception:
Traceback (most recent call last):
File "C:\Python33\lib\site-packages\pip\commands\install.py", line 236, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "C:\Python33\lib\site-packages\pip\req.py", line 1139, in prepare_files
req_to_install.assert_source_matches_version()
File "C:\Python33\lib\site-packages\pip\req.py", line 394, in assert_source_matches_version
version = self.installed_version
File "C:\Python33\lib\site-packages\pip\req.py", line 390, in installed_version
return self.pkg_info()['version']
File "C:\Python33\lib\site-packages\pip\req.py", line 357, in pkg_info
data = self.egg_info_data('PKG-INFO')
File "C:\Python33\lib\site-packages\pip\req.py", line 297, in egg_info_data
data = fp.read()
UnicodeDecodeError: 'cp932' codec can't decode byte 0xef in position 1876: illegal multibyte sequence
解決策
公開されているZIPをダウンロードして、解凍する
中にある setup スクリプトを実行してインストールする
> setup.py install
C:\Python33\Scripts\ghp-import
ファイルが作成されていますが、これだけだとコマンドプロンプトから実行できません。
なので、バッチファイルを作成します。
C
@"C:\Python33\python3.3.exe" "C:\Python33\Scripts\ghp-import" %*
これで、ghp-import コマンドが使用できるようになります。