3

I've been getting the following notice every time I fire up Terminal recently:

/usr/local/lib/python3.5/site-packages/powerline/bindings/zsh/powerline.zsh:200: /usr/local/bin/powerline-config: bad interpreter: /usr/local/opt/python3/bin/python3.5: no such file or directory /usr/local/lib/python3.5/site-packages/powerline/bindings/zsh/powerline.zsh:204: /usr/local/bin/powerline-config: bad interpreter: /usr/local/opt/python3/bin/python3.5: no such file or directory'

I posted this to the powerline GitHub page as an issue and was advised that I have probably updated my Python version on macOS without me knowing (through homebrew or perhaps through a system update, since I'm a macOS Beta user).

Is there a way to update Python packages en-masse in macOS as in Gentoo, as pointed out in the linked GitHub issue? The dev mentioned that there is a python-updater script in Gentoo that is used to update packages after updating Python, but no such script exists for macOS.

OS: macOS 10.12.3 Beta

Any help would be appreciated!

-- paanvaannd

4

1 回答 1

4

我认为来自powerlineGitHub 页面的诊断是正确的:您通过 Homebrew 将 Python 3.5 更新到了 3.6,因此期待 3.5 解释器的东西被破坏了。我已经做过几次了。

我发现让事情保持清醒的最好方法是存储已安装包的列表,删除它们,通过 Homebrew 更新 Python,然后重新安装包列表。在外壳中,这将是:

$ pip3 list | cut -d " " -f 1 > package-list.txt # Store package names without versions
$ pip3 uninstall -y $(cat package-list.txt) # Cannot use redirection
$ brew update && brew upgrade python3
$ pip3 install $(cat package-list.txt)

这对您现在不是很有帮助,因为您已经升级而没有保留此列表。一种选择是通过 Homebrew 回滚 Python 安装。如果你还没有完成brew cleanup,你可以做brew switch python3 3.5.xx​​你拥有的最新版本在哪里)。在此之后,您可以执行上述过程,交换brew upgrade python3.brew switch python3 3.6.0

如果您已经清理了以前的安装,则可以尝试使用此答案重新安装它,然后执行上述操作。

如果这两个都失败了,你可以手动重新安装你的包。查看/usr/local/lib/python3.5/site-packages/您通过 Pip 安装的软件包列表中的内容,然后手动安装它们。最好的办法是选择一个有很多依赖项的,这样你就可以一次安装很多包。

于 2017-01-04T19:59:28.947 回答