Tensorflow 學習筆記(一)mac os 安裝 tensorflow


Homebrew 安裝python

brew install python

安裝pip

curl ‘https://bootstrap.pypa.io/get-pip.py’ > get-pip.py
python get-pip.py

ps: 安裝完之后注意在PATH中指定pip的路徑

安裝tensorflow

pip3 intall tensorflow

安裝中可能會出現timeout error,此時可以嘗試:

pip --default-timeout=1000 install -U tensorflow

或者

#python 2.7, cpu only
下載https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.11.0rc0-py2-none-any.whl文件 pip
install xx.whl

#python 3.6, cpu only
下載https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.11.0rc0-py3-none-any.whl文件
pip install xx.whl

安裝keras

pip3 install keras

驗證安裝是否正確

python

import tensorflow as tf

from keras.models import Sequential

hello = tf.constant('Hello, TensorFlow!')

sess = tf.Session()

sess.run(hello)

model = Sequential()

 

自此,tensorflow安裝完畢,后面會逐漸用tensorflow寫一些實例

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2026 CODEPRJ.COM