파이썬/문제해결 (13) 썸네일형 리스트형 파이썬 한글 문제 해결하기 - SyntaxError: Non-ASCII character SyntaxError: Non-ASCII character '\xec' in file aaa.py on line 8, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details 한글이 포함된 python 코드를 돌리면 위와 같은 에러가 발생한다. 이럴 경우 소스 코드의 최상위에 아래의 문구만 하나 넣어주면 해결이 된다. # -*- coding: utf-8 -*- TypeError: ufunc 'multiply' did not contain a loop with signature matching types dtype('S32') TypeError: ufunc 'multiply' did not contain a loop with signature matching types dtype('S32') 처음 이 에러를 보게 된것은"머신러닝 인 액션" 이라는 책의 예제코드를 테스트하다가 였다. numpy의 array를 생성한 후 연산할 경우 위와 같은 에러가 발생할 수 있다. 또는 Traceback (most recent call last): File "", line 1, in TypeError: ufunc 'multiply' did not contain a loop with signature matching types dtype('S32') dtype('S32') dtype('S32') 책의 예제코드를 보자 >>> a = numpy.ar.. SystemError: Cannot compile 'Python.h'. Perhaps you need to install python-dev|python-devel. SystemError: Cannot compile 'Python.h'. Perhaps you need to install python-dev|python-devel. numpy 설치 시 위와 같은 메시지가 나타나고 설치에 실패하였다면아래의 링크과 비슷한 유형의 문제이다. http://chandong83.blog.me/220832858287 즉, python-dev 패키지를 설치해주면 된다. $ sudo apt-get install python-dev UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 54: ordinal not in range(128) UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 54: ordinal not in range(128) 위의 문제는 locale이 안 맞아서 생기는 문제이다.아래와 같이 LC_ALL=C를 추가해주면 Locale을 영어로 기준잡고 pip install을 실행한다. $ export LC_ALL=C$ pip install numpy pip install error Cleaning up...Exception:Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 122, in main status = self.run(options, args) File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 290, in run requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle) File "/usr/lib/python2.7/dist-packages/pip/req.py", lin.. 이전 1 2 다음