Closed haha23h closed 5 years ago
pip install .
명령을 실행하실 때 python 환경의 버전이 낮은 것 같습니다.
코드의 f'{_SRC_NAME}.zip'
이 부분에 f-strings literal을 사용했는데 이 때문이 아닐까 생각합니다.
이는 Python 3.6 이상에서만 적용되는 문법으로 예전에 호환성을 위해 수정한 적이 있는데 미처 덜 수정한 부분입니다.
해결책으로는
from:
with zipfile.ZipFile(f'{_SRC_NAME}.zip', 'r') as src_zip:
src_zip.extractall()
build_dir = f'{_SRC_NAME}/build'
os.makedirs(build_dir, exist_ok=True)
subprocess.check_call('cmake ..', cwd=build_dir, shell=True)
subprocess.check_call('make all resource', cwd=build_dir, shell=True)
shutil.rmtree('khaiii/lib', ignore_errors=True)
shutil.copytree(f'{build_dir}/lib', 'khaiii/lib')
shutil.rmtree('khaiii/share', ignore_errors=True)
shutil.copytree(f'{build_dir}/share', 'khaiii/share')
to:
with zipfile.ZipFile('{}.zip'.format(_SRC_NAME), 'r') as src_zip:
src_zip.extractall()
build_dir = '{}/build'.format(_SRC_NAME)
os.makedirs(build_dir, exist_ok=True)
subprocess.check_call('cmake ..', cwd=build_dir, shell=True)
subprocess.check_call('make all resource', cwd=build_dir, shell=True)
shutil.rmtree('khaiii/lib', ignore_errors=True)
shutil.copytree('{}/lib'.format(build_dir), 'khaiii/lib')
shutil.rmtree('khaiii/share', ignore_errors=True)
shutil.copytree('{}/share'.format(build_dir), 'khaiii/share')
버전 업그레이드로 해결했습니다. 감사합니다~
Python 3.6 버전 아래에서 설치 스크립트 오류가 나는 부분을 수정하기 위해 (f-strings 관련) 이슈를 열어둡니다.
Processing /data/khaiii/build/package_python Complete output from command python setup.py egg_info: Traceback (most recent call last): File "", line 1, in
File "/tmp/pip-req-build-oaZYzh/setup.py", line 45
with zipfile.ZipFile(f'{_SRC_NAME}.zip', 'r') as src_zip:
^
SyntaxError: invalid syntax
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-req-build-oaZYzh/