【机器学习入门笔记1:anaconda一站式开发环境搭建】20190122
?
2019-01-22?by 崔斐然
計劃使用anaconda集成開發(fā)環(huán)境
1、安裝anaconda
2、部署TensorFlow和OpenCV
3、安裝notebook
整個過程預計需要1小時左右,(更換清華源的話一般十分鐘就好了)可以在旁邊背背單詞
清華鏡像下載地址:https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/
20190216附加一件換源腳本:
腳本來自清華源:
wget https://tuna.moe/oh-my-tuna/oh-my-tuna.py # For yourself python oh-my-tuna.py # ...or for everyone! sudo python oh-my-tuna.py --global # Get some help python oh-my-tuna.py -h一鍵換源腳本,省時省力,詳情:https://mirrors.tuna.tsinghua.edu.cn/news/#oh-my-tuna
官網(wǎng)下載地址:https://www.anaconda.com/download/#macos? (直接下載非常慢,建議鏡像下載,也可以安裝迅雷下載)
TensorFlow同上
回到home
安裝juputer,啟動后測試代碼:
import cv2 print('hello opencv') import tensorflow as tf hello = tf.constant('hello tensorflow') sess = tf.Session() print(sess.run(hello))?
喜歡pycharm的可以在偏好里配置,或在新建項目時使用已有環(huán)境
使用pycharm方法:
可以先下載免費試用版。擁有edu郵箱的可以使用免費專業(yè)版一年。
下面三個地方都填一下Python地址,注意選擇你自己的安裝位置,下面以我的anaconda位置為例。
最好三個都填一下吧
當出現(xiàn)下圖的OpenCV時候則說明pycharm環(huán)境變量正確了
新建項目選擇已有環(huán)境
測試代碼:
import cv2import tensorflow as tf print("OpenCV is ok") test=tf.constant('tensorflow is ok') sess=tf.Session() print(sess.run(test))看到OpenCV is OK,TensorFlow is OK 則說明沒有問題了。上面的警告是指
您下載的TensorFlow太low了,根本沒有通過兼容AVX來Compile。如果您下載源代碼在該電腦上重新compile,就可以支持AVX。其實你的電腦是支持AVX的,只是編譯好的TensorFlow不支持。
import os import tensorflow as tf os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # 降低日志警告等級data1 = tf.constant(2.5) # 定義一個常亮 data2 = tf.Variable(10, name='var') # 定義一個變量 print(data1) print(data2)sess = tf.Session() print(sess.run(data1))init = tf.global_variables_initializer() sess.run(init) print(sess.run(data2))警告對于練習代碼時候無關(guān)緊要,要緊的是趕快學會后面的內(nèi)容。做生產(chǎn)時候再考慮這些問題叭(●′?`●)ノ
《新程序員》:云原生和全面數(shù)字化實踐50位技術(shù)專家共同創(chuàng)作,文字、視頻、音頻交互閱讀總結(jié)
以上是生活随笔為你收集整理的【机器学习入门笔记1:anaconda一站式开发环境搭建】20190122的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 安装brew提示/usr/local/b
- 下一篇: macOS下使用anaconda相关系列