LoginSignup
0
0

More than 3 years have passed since last update.

Macでpip3が使えなくなった

Last updated at Posted at 2019-07-09

環境: Mac Mojave, Homebrew
Homebrewでインストールしたpip3がいつの間にかパスが通っていなくて使えなくなっていた。python3やモジュールのimportは正常で可能。

$ brew reinstall python

とすると、

...
Warning: The post-install step did not complete successfully
You can try again using `brew postinstall python`

と警告がでた、ここでファイルのPermission Deniedが出たいたので、ひとつずつdeniedされたファイルが入っているディレクトリを

$ chown -R username DeniedDirectoryPath

としていき所有者を変えていくと、postinstallに成功した。(前回のインストール時に変なことをして、所有者がrootになった?)

このタイミングで、pip3へのパスが通ったが、pip listしようとすると、

ValueError: ("Missing 'Version:' header and/or METADATA file at path: /usr/local/lib/python3.7/site-packages/-ip-19.0.1.dist-info/METADATA", Unknown [unknown version] (/usr/local/lib/python3.7/site-packages))

とエラーが出た。
pipでAttributeError: _versionが出たときの対応を参考に、-ip-19.0.1.dist-infoをip-19.0.1.dist-infoに名前を変更し、再び、pip listすると、

No such file or directory: '/usr/local/lib/python3.7/site-packages/ip-19.0.1.dist-info/METADATA'

とエラーが出たので、ip-19.0.1.dist-info/pip-19.0.1.dist-info内のファイルをip-19.0.1.dist-info直下にコピーしたら、これでpip3が正常に動くようになった。

PC中にファイルがばらまかれていて、フォルダの依存関係がてんで分かりません。再起動時にlogが消えてしまったので具体的なエラーは消えてしまいましたが、誰かの救いになれば幸いです。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0