3

OSX 10.7.5 では、pip3コマンドを使用してパッケージを python3 にインストールしようとしています。試してみると、次のエラー メッセージが表示されます。

zak$ pip3
Traceback (most recent call last):
  File "/usr/local/Cellar/python3/3.3.2/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/setuptools-1.0-py3.3.egg/pkg_resources.py", line 2793, in <module>
  File "/usr/local/Cellar/python3/3.3.2/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/setuptools-1.0-py3.3.egg/pkg_resources.py", line 673, in require
  File "/usr/local/Cellar/python3/3.3.2/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/setuptools-1.0-py3.3.egg/pkg_resources.py", line 580, in resolve
pkg_resources.VersionConflict: (pip 1.4.1 (/usr/local/lib/python3.3/site-packages), Requirement.parse('pip==1.3.1'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/pip3", line 5, in <module>
    from pkg_resources import load_entry_point
  File "<frozen importlib._bootstrap>", line 1567, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1534, in _find_and_load_unlocked
  File "/usr/local/Cellar/python3/3.3.2/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/setuptools-1.0-py3.3.egg/pkg_resources.py", line 2797, in <module>
  File "/usr/local/Cellar/python3/3.3.2/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/setuptools-1.0-py3.3.egg/pkg_resources.py", line 576, in resolve
pkg_resources.DistributionNotFound: pip==1.3.1

setuptools古いバージョンの pip (私は 1.4.1 をインストールしています) を要求しているように見えますが、なぜですか? どうすればこれを修正できますか?

4

3 に答える 3

2

The problem appears to be that you have two different Python 3.3 installations, and a shared site-packages directory.* And the tool you run as pip3 is from pip 1.3.1, but the modules it uses to do its work come from pip 1.4.1.

The easiest way to solve this, unless you actually need both Python 3.3 installations, is to get rid of both of them completely, then reinstall the one you want.

The following should work (possibly with sudo for some of the commands—or using Finder and letting it tell you whether you need to authenticate).

Note that this will also partially or completely remove any other third-party Python versions (e.g., a python.org 2.7.5), which I don't think is a problem for you, but could be for future readers.

You might want to make a list of all installed packages before uninstalling anything. (I usually do this in the hackiest way possible: fire up ipython, and let it tab-complete an import statement…)

Finally, some of these details will be different for any future readers with similar problems, but the basic ideas should be the same.

  • brew uninstall python3
  • rm -rf /Library/Frameworks/Python.framework
  • rm -rf /usr/local/lib/python*
  • rm -rf /usr/local/share/python*
  • Find where in ~/.bash_profile (or ~/.profile or elsewhere) you add the Python paths to your PATH. You may have /usr/local/share/python3 and/or something inside the Python.framework or Cellar/python3. Scrap all that you find.
  • Fire up a new shell in Terminal.app.
  • brew doctor, and fix anything that it complains about that seems potentially relevant (the non-Homebrew MacFUSE stuff is fine as-is; the brew prune suggestion is probably worth doing, but doesn't matter here), and run it again to make sure.
  • brew install python3.
  • pip3 to reinstall any packages you deleted that you need again.

* Details:

  • Homebrew Python 3.3 は にインストールされて/usr/local/Cellar/python3/3.3.2/おり、さまざまなものが/usr/local/binとその兄弟、そしておそらく/Libraryどこかにシンボリックリンクされています。
  • おそらくpython.orgインストーラーからの別のPython 3.3がにインストールされ/Library/Frameworks/Python.framework/Versions/3.3/、さまざまなものがシンボリックリンクされて/usr/local/binいるか、PATHに追加されている可能性があります。
  • どちらもおそらく/usr/local/lib/python3.3サイトパッケージ検索に含まれています。
于 2013-08-23T20:44:47.090 に答える
0

走った後

pip install --upgrade setuptools

私はそれを修正することができました。しかし、私はまだ Python を学んでいるので、これはすべての人に当てはまるとは限りません。

于 2016-08-03T17:16:40.493 に答える