cmd. python line_profiler 설치 오류
조회수 3485회
안녕하세요. cmd에 pip install line_profiler 를 했을 때 계속 오류가 떠서 질문드립니다. 이 외에도 sudo, -m line_profiler 등의 다양한 pip 설치 명령어를 입력했음에도 같은 오류 문구가 뜨네요
C:\Users\USER>pip install line_profiler Collecting line_profiler Using cached https://files.pythonhosted.org/packages/14/fc/ecf4e238bb601ff829068e5a72cd1bd67b0ee0ae379db172eb6a0779c6b6/line_profiler-2.1.2.tar.gz Requirement already satisfied: IPython>=0.13 in c:\program files\python37\lib\site-packages (from line_profiler) (7.7.0) Requirement already satisfied: setuptools>=18.5 in c:\program files\python37\lib\site-packages (from IPython>=0.13->line_profiler) (39.0.1) Requirement already satisfied: prompt-toolkit=2.0.0 in c:\program files\python37\lib\site-packages (from IPython>=0.13->line_profiler) (2.0.9) Requirement already satisfied: decorator in c:\program files\python37\lib\site-packages (from IPython>=0.13->line_profiler) (4.4.0) Requirement already satisfied: pygments in c:\program files\python37\lib\site-packages (from IPython>=0.13->line_profiler) (2.4.2) Requirement already satisfied: traitlets>=4.2 in c:\program files\python37\lib\site-packages (from IPython>=0.13->line_profiler) (4.3.2) Requirement already satisfied: colorama; sys_platform == "win32" in c:\program files\python37\lib\site-packages (from IPython>=0.13->line_profiler) (0.4.1) Requirement already satisfied: backcall in c:\program files\python37\lib\site-packages (from IPython>=0.13->line_profiler) (0.1.0) Requirement already satisfied: pickleshare in c:\program files\python37\lib\site-packages (from IPython>=0.13->line_profiler) (0.7.5) Requirement already satisfied: jedi>=0.10 in c:\program files\python37\lib\site-packages (from IPython>=0.13->line_profiler) (0.14.1) Requirement already satisfied: six>=1.9.0 in c:\program files\python37\lib\site-packages (from prompt-toolkit=2.0.0->IPython>=0.13->line_profiler) (1.12.0) Requirement already satisfied: wcwidth in c:\program files\python37\lib\site-packages (from prompt-toolkit=2.0.0->IPython>=0.13->line_profiler) (0.1.7) Requirement already satisfied: ipython-genutils in c:\program files\python37\lib\site-packages (from traitlets>=4.2->IPython>=0.13->line_profiler) (0.2.0) Requirement already satisfied: parso>=0.5.0 in c:\program files\python37\lib\site-packages (from jedi>=0.10->IPython>=0.13->line_profiler) (0.5.1) Installing collected packages: line-profiler Running setup.py install for line-profiler ... error ERROR: Command errored out with exit status 1: command: 'c:\program files\python37\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\USER\AppData\Local\Temp\pip-install-cz2432i9\line-profiler\setup.py'"'"'; file='"'"'C:\Users\USER\AppData\Local\Temp\pip-install-cz2432i9\line-profiler\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record 'C:\Users\USER\AppData\Local\Temp\pip-record-1z7_pya\install-record.txt' --single-version-externally-managed --compile cwd: C:\Users\USER\AppData\Local\Temp\pip-install-cz2432i9\line-profiler\ Complete output (46 lines): Could not import Cython. Using the available pre-generated C file. running install running build running build_py creating build creating build\lib.win-amd64-3.7 copying line_profiler.py -> build\lib.win-amd64-3.7 copying kernprof.py -> build\lib.win-amd64-3.7 copying line_profiler_py35.py -> build\lib.win-amd64-3.7 running build_ext building '_line_profiler' extension creating build\temp.win-amd64-3.7 creating build\temp.win-amd64-3.7\Release C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD "-Ic:\program files\python37\include" "-Ic:\program files\python37\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\cppwinrt" /Tc_line_profiler.c /Fobuild\temp.win-amd64-3.7\Release_line_profiler.obj _line_profiler.c _line_profiler.c(7890): error C2039: 'exc_type': '_ts'의 멤버가 아닙니다. c:\program files\python37\include\pystate.h(209): note: '_ts' 선언을 참조하십시오. _line_profiler.c(7891): error C2039: 'exc_value': '_ts'의 멤버가 아닙니다. c:\program files\python37\include\pystate.h(209): note: '_ts' 선언을 참조하십시오. _line_profiler.c(7892): error C2039: 'exc_traceback': '_ts'의 멤버가 아닙니다. c:\program files\python37\include\pystate.h(209): note: '_ts' 선언을 참조하십시오. _line_profiler.c(7899): error C2039: 'exc_type': '_ts'의 멤버가 아닙니다. c:\program files\python37\include\pystate.h(209): note: '_ts' 선언을 참조하십시오. _line_profiler.c(7900): error C2039: 'exc_value': '_ts'의 멤버가 아닙니다. c:\program files\python37\include\pystate.h(209): note: '_ts' 선언을 참조하십시오. _line_profiler.c(7901): error C2039: 'exc_traceback': '_ts'의 멤버가 아닙니다. c:\program files\python37\include\pystate.h(209): note: '_ts' 선언을 참조하십시오. _line_profiler.c(7902): error C2039: 'exc_type': '_ts'의 멤버가 아닙니다. c:\program files\python37\include\pystate.h(209): note: '_ts' 선언을 참조하십시오. _line_profiler.c(7903): error C2039: 'exc_value': '_ts'의 멤버가 아닙니다. c:\program files\python37\include\pystate.h(209): note: '_ts' 선언을 참조하십시오. _line_profiler.c(7904): error C2039: 'exc_traceback': '_ts'의 멤버가 아닙니다. c:\program files\python37\include\pystate.h(209): note: '_ts' 선언을 참조하십시오. _line_profiler.c(7959): error C2039: 'exc_type': '_ts'의 멤버가 아닙니다. c:\program files\python37\include\pystate.h(209): note: '_ts' 선언을 참조하십시오. _line_profiler.c(7960): error C2039: 'exc_value': '_ts'의 멤버가 아닙니다. c:\program files\python37\include\pystate.h(209): note: '_ts' 선언을 참조하십시오. _line_profiler.c(7961): error C2039: 'exc_traceback': '_ts'의 멤버가 아닙니다. c:\program files\python37\include\pystate.h(209): note: '_ts' 선언을 참조하십시오. _line_profiler.c(7962): error C2039: 'exc_type': '_ts'의 멤버가 아닙니다. c:\program files\python37\include\pystate.h(209): note: '_ts' 선언을 참조하십시오. _line_profiler.c(7963): error C2039: 'exc_value': '_ts'의 멤버가 아닙니다. c:\program files\python37\include\pystate.h(209): note: '_ts' 선언을 참조하십시오. _line_profiler.c(7964): error C2039: 'exc_traceback': '_ts'의 멤버가 아닙니다. c:\program files\python37\include\pystate.h(209): note: '_ts' 선언을 참조하십시오. error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428\bin\HostX86\x64\cl.exe' failed with exit status 2 ---------------------------------------- ERROR: Command errored out with exit status 1: 'c:\program files\python37\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\USER\AppData\Local\Temp\pip-install-cz2432i9\line-profiler\setup.py'"'"'; __file='"'"'C:\Users\USER\AppData\Local\Temp\pip-install-cz2432i9\line-profiler\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file_, '"'"'exec'"'"'))' install --record 'C:\Users\USER\AppData\Local\Temp\pip-record-_1z7_pya\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.
도대체 어떻게 설치할 수 있는건가요 ㅠㅠ 참고로 python 3.7이상 모델을 사용하고 있습니다.
-
(•́ ✖ •̀)
알 수 없는 사용자
1 답변
-
https://github.com/rkern/line_profiler/issues/132
중간에 보면, 다음과 같은 워크어라운드가 있습니다.
git clone https://github.com/rkern/line_profiler.git find line_profiler -name '*.pyx' -exec cython {} \; cd line_profiler && pip install . --user
첫째줄은 line_profiler 최신소스를 받는 것이고, 마지막 줄은 소스를 통해 패키지를 설치하는 것입니다. (소스 폴더로 위치 옮긴 후에
pip install .
)두번째 줄은 cython 으로 pyx 파일을 컴파일 해주는 작업. 리눅스 기준입니다.
윈도우에선 받은 소스파일 폴더로 가서,
_line_profiler.pyx
라는 파일을 컴파일해주면 됩니다.두번째 줄 대신 아래와 같이 해주면 되더군요.
pip install cython cython -3 _line_profiler.pyx
댓글 입력