macos - 在 Mac 上安装 Python3.6 和 Python3.7
问题描述
我正在尝试使用 Python3.7 将 tensorflow 安装到 Mac 上。但是,我收到了错误:
$ pip3 -v install tensorflow
...
Skipping link https://files.pythonhosted.org/packages/56/7a/c6bca0fe52a94ca508731d8b139e7dbd5a36cddc64c19f422f97e5a853e8/tensorflow-1.10.0rc1-cp36-cp36m-win_amd64.whl#sha256=3ab24374888d6a13d55ce2e3cf4ba0c9cd6f824723313db5322512087525cb78 (from https://pypi.org/simple/tensorflow/); it is not compatible with this Python
Could not find a version that satisfies the requirement tensorflow (from versions: )
Cleaning up...
Removed build tracker '/private/var/folders/4n/9342s4wd3jv0qzwjz8rxrygr0000gp/T/pip-req-tracker-3p60r2lo'
No matching distribution found for tensorflow
据我所知,这是因为 tensorflow 还不支持 Python3.7。作为一种解决方法,我想将 Python3.6 与 3.7 一起安装,然后将 tensorflow 安装到该版本。但是,我是 Mac 的新手,不确定在不弄乱现有 Python 版本的情况下执行此操作的正确方法。
我尝试过使用 brew,但看起来 Python3 就像它得到的一样具体。做我所追求的正确方法是什么?
解决方案
brew
例如,如果已经使用 Python 3,请尝试使用:
$ brew unlink python
$ brew install --ignore-dependencies https://raw.githubusercontent.com/Homebrew/homebrew-core/f2a764ef944b1080be64bd88dca9a1d80130c558/Formula/python.rb
要回到 python3.7.4_1
使用:
$ brew switch python 3.7.4_1
如果需要 3.6 再次切换:
$ brew switch python 3.6.5_1
推荐阅读
- python - Pandas/ Python - 每 X 行将一列转换为新列
- java - BST最后打印“%”的顺序遍历
- python-3.x - Github 上未显示交互式 Jupyter 笔记本
- c++ - 数组创建 int *array = new int[sizeof(int)*n]
- excel - 使用 Excel VBA 获取类属性值
- javascript - 在 HTML5 页面上同时播放视频和音频
- c++ - 运算符重载会影响我的复制构造函数
- android - 按钮单击dialogFragment后如何在谷歌地图上添加标记?
- java - 为 SpringBoot 应用程序指定密钥库时 javax.net.ssl.keyStore 和 server.ssl.key-store 属性有什么区别
- java - 从表中获取所有检查值