나는 python2.7에서 개발 된 파이썬 패키지를 가지고 있지만 파이썬 3.6으로 포팅해야한다. 코드의 일부에서 cython을 사용하므로 패키지에 .py
과 .pyx
파일이 모두 있습니다.파이썬 2에서 파이썬 2로 파이썬 2로 이식하기
나는 2to3
명령을 시도했지만 이해할 수없고 해결할 수 없다는 오류가 발생했습니다.
예 : 나는 다음과 같은 test.pyx
파일을
# cython: profile=False
cimport cython
@cython.boundscheck(False)
@cython.wraparound(False)
@cython.profile(False)
cpdef sillyfunction():
print 'Thank you for your kind help'
return
을하고 난 2to3 test.pyx
를 실행합니다. 내가 얻는 것은 :
[email protected]:~$ 2to3 test.pyx
RefactoringTool: Skipping optional fixer: buffer
RefactoringTool: Skipping optional fixer: idioms
RefactoringTool: Skipping optional fixer: set_literal
RefactoringTool: Skipping optional fixer: ws_comma
RefactoringTool: Can't parse test.pyx: ParseError: bad input: type=1, value=u'cython', context=(u' ', (2, 8))
RefactoringTool: No files need to be modified.
RefactoringTool: There was 1 error:
RefactoringTool: Can't parse test.pyx: ParseError: bad input: type=1, value=u'cython', context=(u' ', (2, 8))