업데이트 - sys.path 값

업데이트 - sys.path 값

원래 시스템 Python(현재 macOS 버전의 경우 2.7.2)을 제외한 모든 항목을 제거하여 MacBook Pro(macOS 10.13.4)에서 다양한 Python 설치를 정리하려고 합니다. 나는 python.org, macports 및 homebrew에서 한 번에 설치를 해왔고 이러한 설치와 관련된 모든 것을 삭제할 수 있다고 생각하지만 모듈을 설치하려고 하면 내 시스템 Python이 여전히 나에게 소리를 지릅니다.

homebrew python 및 pip 설치를 제거하고 macports 설치에서 이전 폴더를 삭제한 후 .bashrc 구성 및 iTerm2 유틸리티만 포함하도록 ~/.bash_profile을 업데이트했습니다. 그런 다음 easy_install을 사용하여 시스템 Python용 PIP를 설치했습니다. 그런데 voltron과 같은 패키지를 설치하려고 하면 다음과 같은 오류가 발생하고 설치가 완료되지 않습니다.

matplotlib 1.3.1 requires nose, which is not installed.
python-dateutil 2.6.1 has requirement six>=1.5, but you'll have six 1.4.1 which is incompatible.
prompt-toolkit 1.0.15 has requirement six>=1.9.0, but you'll have six 1.4.1 which is incompatible.
blessed 1.14.2 has requirement six>=1.9.0, but you'll have six 1.4.1 which is incompatible.
matplotlib 1.3.1 has requirement numpy>=1.5, but you'll have numpy 1.8.0rc1 which is incompatible.

which python반환 /usr/bin/pythonwhich pip반환/usr/local/bin/pip

컴퓨터를 상자에서 꺼냈을 때의 상태로 되돌리고 싶지만 지우고 다시 설치하고 싶지는 않습니다. macOS 복구 모드를 사용하여 macOS를 다시 설치해 보았지만 오류가 변경되지 않았기 때문에 어딘가에 이러한 패키지에 대한 참조가 남아 있는 것 같습니다. Python의 원래 상태를 어떻게 복원할 수 있나요?


$> pip -V
pip 10.0.0b2 from /Library/Python/2.7/site-packages/pip-10.0.0b2-py2.7.egg/pip (python 2.7)

실제로 Voltron을 설치한 것처럼 보이지만 여전히 누락된 종속성에 대한 오류가 표시됩니다. 그 중 하나(이 경우 6개)를 설치하려고 하면 다음과 같은 일이 발생합니다.

$> pip install --user six
Requirement already satisfied: six in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (1.4.1)
python-dateutil 2.6.1 has requirement six>=1.5, but you'll have six 1.4.1 which is incompatible.
prompt-toolkit 1.0.15 has requirement six>=1.9.0, but you'll have six 1.4.1 which is incompatible.
blessed 1.14.2 has requirement six>=1.9.0, but you'll have six 1.4.1 which is incompatible.
matplotlib 1.3.1 has requirement numpy>=1.5, but you'll have numpy 1.8.0rc1 which is incompatible.

업데이트 - sys.path 값

$> python -c "import os, sys; print(os.linesep.join(sys.path))"

/Library/Python/2.7/site-packages/pip-10.0.0b2-py2.7.egg
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload
/Users/emroch/Library/Python/2.7/lib/python/site-packages
/Library/Python/2.7/site-packages
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC

답변1

PIP로 패키지를 설치할 때 비슷한 문제가 발생했는데 문제의 원인은 다음과 같습니다. https://github.com/pypa/pip/issues/5196

여기에 제안된 내용에 따라 문제를 해결할 수 있습니다. https://stackoverflow.com/questions/27630114/matplotlib-issue-on-os-x-importerror-cannot-import-name-thread

sudo pip uninstall python-dateutil
sudo pip install python-dateutil==2.2

@oriol-nieto 답변에서

Python은 이전 버전 6을 사용하고 있었는데 다음을 입력하여 제거했습니다.

rm -rf /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six.*

관련 정보