更新 - sys.path の値

更新 - sys.path の値

私は MacBook Pro (macOS 10.13.4) 上のさまざまな Python インストールをクリーンアップしようとしています。元のシステム Python (現在のバージョンの macOS では 2.7.2) 以外のすべてを削除しています。python.org、macports、homebrew からインストールしたことがあり、これらのインストールが関係するものはすべて削除できたと思いますが、モジュールをインストールしようとすると、システム Python がまだ警告を発します。

自作の 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 がインストールされたようですが、依存関係が不足しているためエラーが表示されています。そのうちの 1 つ (この場合は 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でパッケージをインストールするときに同様の問題が発生しましたが、問題の原因はこれのようです。 pypa の最新バージョンは pypa.py にあります。

ここで提案されている方法に従って問題を解決できました 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.*

関連情報