咱们已经将 TensorFlow 二进制文件上传到了 PyPI,所以你能够经过 pip 安装, REQUIRED_PACKAGES section of setup.py 文件列出了 pip 将要安装或升级的包。html
要安装 TensorFlow,你的系统必须依据安装了如下任一 Python 版本:python
若是你的系统尚未安装符合以上版本的 Python,如今安装。git
安装 Python,你可能须要禁用系统完整性保护(SIP)来得到从 Mac App Store 外安装软件的许可。github
Pip 安装和管理 Python写的软件包,若是你要使用本地 pip 安装,系统上必须安装下面的任一 pip 版本:shell
pip
, for Python 2.7pip3
, for Python 3.n.pip 或者 pip3 可能在你安装 Python 的时候已经安装了,执行如下任一命令确认系统上是否安装了 pip 或 pip3:api
$ pip -V # for Python 2.7 $ pip3 -V # for Python 3.n
咱们强烈建议使用 pip 或者 pip3 为 8.1 或者更新的版本安装 TensorFlow,若是没有安装,执行如下任一命令安装或更新:ruby
$ sudo easy_install --upgrade pip $ sudo easy_install --upgrade six
假设你的 Mac 上已经装好了必备的程序,按照如下步骤执行:python2.7
shell $ pip install tensorflow # Python 2.7; CPU support $ pip3 install tensorflow # Python 3.n; CPU support
ui
若是上面的命令执行完成,如今能够验证你的安装了。google
shell $ sudo pip install --upgrade tfBinaryURL # Python 2.7 $ sudo pip3 install --upgrade tfBinaryURL # Python 3.n
tfBinaryURL 是 Tensorflow 包的 URL,准确的 tfBinaryURL 值因操做系统和 Python 版本而异,在这里找到和你系统相关的 tfBinaryURL 值。例如,你要在 Mac OS X 上安装 Python 2.7 对应的 Tensorflow 版本,在虚拟环境中安装 Tensorflow 就执行下面的命令:
shell $ sudo pip3 install --upgrade \ https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.2.1-py2-none-any.whl
DEPRECATION: Uninstalling a distutils installed project (six) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
Uninstalling six-1.4.1:
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip/commands/install.py", line 342, in run
prefix=options.prefix_path,
File "/Library/Python/2.7/site-packages/pip/req/req_set.py", line 778, in install
requirement.uninstall(auto_confirm=True)
File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 754, in uninstall
paths_to_remove.remove(auto_confirm)
File "/Library/Python/2.7/site-packages/pip/req/req_uninstall.py", line 115, in remove
renames(path, new_path)
File "/Library/Python/2.7/site-packages/pip/utils/__init__.py", line 267, in renames
shutil.move(old, new)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 302, in move
copy2(src, real_dst)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 131, in copy2
copystat(src, dst)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 103, in copystat
os.chflags(dst, st.st_flags)
OSError: [Errno 1] Operation not permitted: '/tmp/pip-mUKyli-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six-1.4.1-py2.7.egg-info'
sudo pip install --upgrade --ignore-installed six
DEPRECATION: Uninstalling a distutils installed project (numpy) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip/commands/install.py", line 342, in run
prefix=options.prefix_path,
File "/Library/Python/2.7/site-packages/pip/req/req_set.py", line 778, in install
requirement.uninstall(auto_confirm=True)
File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 754, in uninstall
paths_to_remove.remove(auto_confirm)
File "/Library/Python/2.7/site-packages/pip/req/req_uninstall.py", line 115, in remove
renames(path, new_path)
File "/Library/Python/2.7/site-packages/pip/utils/__init__.py", line 267, in renames
shutil.move(old, new)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 302, in move
copy2(src, real_dst)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 131, in copy2
copystat(src, dst)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 103, in copystat
os.chflags(dst, st.st_flags)
OSError: [Errno 1] Operation not permitted: '/tmp/pip-I9uezC-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy-1.8.0rc1-py2.7.egg-info'
sudo pip install --upgrade --ignore-installed numpy