2011年6月5日

Cygwin の Python で日本語エラー [失敗]

日本語のユニコードを使おうと .py に

ustr = u"日本語"

として、 C-c すると

  File "<stdin>", line 1
SyntaxError: Non-ASCII character '\x93' in file <stdin> on line 1, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details

と怒れれるので、

M-x eshell
cd ~/download
wget http://www.python.jp/pub/JapaneseCodecs/JapaneseCodecs-1.4.11.tar.gz
tar zxvf JapaneseCodecs-1.4.11.tar.gz
cd JapaneseCodecs-1.4.11/
python setup.py install

とやったが、エラーでうまくいかず

/usr/lib/python2.6/distutils/dist.py:250: UserWarning: 'licence' distribution option is deprecated; use 'license'
  warnings.warn (msg)
running install
running build
running build_py
creating build
creating build/lib.cygwin-1.7.9-i686-2.6
creating build/lib.cygwin-1.7.9-i686-2.6/japanese
copying japanese/euc_jp.py -> build/lib.cygwin-1.7.9-i686-2.6/japanese
copying japanese/iso_2022_jp.py -> build/lib.cygwin-1.7.9-i686-2.6/japanese
copying japanese/iso_2022_jp_1.py -> build/lib.cygwin-1.7.9-i686-2.6/japanese
copying japanese/iso_2022_jp_ext.py -> build/lib.cygwin-1.7.9-i686-2.6/japanese
copying japanese/jis_7.py -> build/lib.cygwin-1.7.9-i686-2.6/japanese
copying japanese/jis_x_0201_katakana.py -> build/lib.cygwin-1.7.9-i686-2.6/japanese
copying japanese/jis_x_0201_roman.py -> build/lib.cygwin-1.7.9-i686-2.6/japanese
copying japanese/ms932.py -> build/lib.cygwin-1.7.9-i686-2.6/japanese
copying japanese/shift_jis.py -> build/lib.cygwin-1.7.9-i686-2.6/japanese
copying japanese/sjis.py -> build/lib.cygwin-1.7.9-i686-2.6/japanese
copying japanese/ujis.py -> build/lib.cygwin-1.7.9-i686-2.6/japanese
copying japanese/windows_31j.py -> build/lib.cygwin-1.7.9-i686-2.6/japanese
copying japanese/__init__.py -> build/lib.cygwin-1.7.9-i686-2.6/japanese
creating build/lib.cygwin-1.7.9-i686-2.6/japanese/python
copying japanese/python/euc_jp.py -> build/lib.cygwin-1.7.9-i686-2.6/japanese/python
copying japanese/python/iso_2022_jp.py -> build/lib.cygwin-1.7.9-i686-2.6/japanese/python
copying japanese/python/iso_2022_jp_1.py -> build/lib.cygwin-1.7.9-i686-2.6/japanese/python
copying japanese/python/iso_2022_jp_ext.py -> build/lib.cygwin-1.7.9-i686-2.6/japanese/python
copying japanese/python/shift_jis.py -> build/lib.cygwin-1.7.9-i686-2.6/japanese/python
copying japanese/python/__init__.py -> build/lib.cygwin-1.7.9-i686-2.6/japanese/python
creating build/lib.cygwin-1.7.9-i686-2.6/japanese/c
copying japanese/c/euc_jp.py -> build/lib.cygwin-1.7.9-i686-2.6/japanese/c
copying japanese/c/iso_2022_jp.py -> build/lib.cygwin-1.7.9-i686-2.6/japanese/c
copying japanese/c/iso_2022_jp_1.py -> build/lib.cygwin-1.7.9-i686-2.6/japanese/c
copying japanese/c/iso_2022_jp_ext.py -> build/lib.cygwin-1.7.9-i686-2.6/japanese/c
copying japanese/c/ms932.py -> build/lib.cygwin-1.7.9-i686-2.6/japanese/c
copying japanese/c/shift_jis.py -> build/lib.cygwin-1.7.9-i686-2.6/japanese/c
copying japanese/c/__init__.py -> build/lib.cygwin-1.7.9-i686-2.6/japanese/c
creating build/lib.cygwin-1.7.9-i686-2.6/japanese/mappings
copying japanese/mappings/euc_jp.py -> build/lib.cygwin-1.7.9-i686-2.6/japanese/mappings
copying japanese/mappings/jis_x_0208.py -> build/lib.cygwin-1.7.9-i686-2.6/japanese/mappings
copying japanese/mappings/jis_x_0212.py -> build/lib.cygwin-1.7.9-i686-2.6/japanese/mappings
copying japanese/mappings/shift_jis.py -> build/lib.cygwin-1.7.9-i686-2.6/japanese/mappings
copying japanese/mappings/__init__.py -> build/lib.cygwin-1.7.9-i686-2.6/japanese/mappings
creating build/lib.cygwin-1.7.9-i686-2.6/japanese/aliases
copying japanese/aliases/__init__.py -> build/lib.cygwin-1.7.9-i686-2.6/japanese/aliases
running build_ext
building 'japanese.c._japanese_codecs' extension
creating build/temp.cygwin-1.7.9-i686-2.6
creating build/temp.cygwin-1.7.9-i686-2.6/src
gcc -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/usr/include/python2.6 -c src/_japanese_codecs.c -o build/temp.cygwin-1.7.9-i686-2.6/src/_japanese_codecs.o
src/_japanese_codecs.c:12:20: fatal error: Python.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1

0 件のコメント:

コメントを投稿