Tensorflow install problems

安裝方法鏈接:
官網(wǎng)Download and install
極客學(xué)院中文教程

mac 系統(tǒng)OS X EI capitan時(shí)遇到一些問題:

1. 采用pip安裝,進(jìn)行到利用pip install tensorflow時(shí)報(bào)錯(cuò):
Exception:
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/commands/install.py", line 342, in run
    prefix=options.prefix_path,
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_set.py", line 778, in install
    requirement.uninstall(auto_confirm=True)
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_install.py", line 754, in uninstall
    paths_to_remove.remove(auto_confirm)
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_uninstall.py", line 115, in remove
    renames(path, new_path)
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/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 299, in move
    copytree(src, real_dst, symlinks=True)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 208, in copytree
    raise Error, errors
Error: [('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.py', '/tmp/pip-CdODEu-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.py', "[Errno 1] Operation not permitted: '/tmp/pip-CdODEu-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.pyc', '/tmp/pip-CdODEu-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.pyc', "[Errno 1] Operation not permitted: '/tmp/pip-CdODEu-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.py', '/tmp/pip-CdODEu-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.py', "[Errno 1] Operation not permitted: '/tmp/pip-CdODEu-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.pyc', '/tmp/pip-CdODEu-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.pyc', "[Errno 1] Operation not permitted: '/tmp/pip-CdODEu-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib', '/tmp/pip-CdODEu-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib', "[Errno 1] Operation not permitted: '/tmp/pip-CdODEu-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib'")]

sudo方式同樣無效,推測可能是OSX的安全策略導(dǎo)致修改系統(tǒng)目錄權(quán)限失???采用VirtualEnv凡是安裝

2. 按照官網(wǎng)VirtualEnv方式完成安裝后。運(yùn)行Python,測試是否安裝成功時(shí):
 >>> import tensorflow as tf

會(huì)報(bào)錯(cuò):

Error importing tensorflow.  Unless you are using bazel,
you should not try to import tensorflow from its source directory;
please exit the tensorflow source tree, and relaunch your python interpreter
from there.

解決方案參考@raingo 解釋,需要先reinstall protobuf后再reinstall Tensorflow:

  - pip install -U protobuf==3.0.0b2
  - pip install --upgrade $TF_BINARY_URL

注意由于是VirtualEnv安裝方式,需要先啟動(dòng)VirtualEnv。

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • 網(wǎng)址 下載與安裝 你可以使用我們提供的 Pip, Docker, Virtualenv, Anaconda 或 源...
    九七學(xué)姐閱讀 4,919評論 3 11
  • 1. 介紹 首先讓我們來看看TensorFlow! 但是在我們開始之前,我們先來看看Python API中的Ten...
    JasonJe閱讀 11,981評論 1 32
  • 桃林是你盛名的青冢, 還是一場浮夸的夢, 說什么蔭蔽后世, 卻為何,飲干河澤? 你夸耀著奔赴太陽, 難道月亮 就盛...
    茹冉閱讀 333評論 0 5
  • 恨為誰生,為誰滅 心魔若起 邪念善意難辨 正惡遙遙終在己 落日夭夭化相思 愛恨相守憎惜處 暫忘心念將魔化 恨意也升...
    關(guān)酌閱讀 269評論 0 1
  • 真不敢相信我們是一步一個(gè)腳印爬上去又走下來的!… 大山,真的是有一種特殊的教育魅力,以前呢只知道它...
    天思靜默閱讀 766評論 0 9

友情鏈接更多精彩內(nèi)容