3C科技 娛樂遊戲 美食旅遊 時尚美妝 親子育兒 生活休閒 金融理財 健康運動 寰宇綜合

Zi 字媒體

2017-07-25T20:27:27+00:00
加入好友
Python機器學習自學/自修 整理[00001] ~安裝開發環境 01.在WINDOWS下安裝Python3.8[Anaconda x32]     URL: https://www.anaconda.com/products/individual 02.測試開發環境     開啟Spyder (Anaconda3) import sys print(sys.version_info) print(sys.version) print('hello, world!') print("你好, 世界!") #runfile('C:/Users/jashliao/.spyder-py3/temp.py', wdir='C:/Users/jashliao/.spyder-py3') #sys.version_info(major=3, minor=8, micro=3, releaselevel='final', serial=0) #3.8.3 (default, Jul 2 2020, 17:28:51) [MSC v.1916 32 bit (Intel)] #hello, world! #你好, 世界! 03.修正Spyder無法繪圖的錯誤     提示訊息如下:「Figures now render in the Plots pane by default. To make them also appear inline in the Console, uncheck “Mute Inline Plotting” under the Plots pane options menu. 」     想要弹出窗口显示matplotlib画的图片,修改设置:         『Tools > Preferences > iPython console > Graphics > Graphics backend > Automatic』         重启IDE,现在画图就会弹出窗口显示了。 import numpy as np import matplotlib.pyplot as pt x = np.arange(0 , 360) y = np.sin( x * np.pi / 180.0) pt.plot(x,y) pt.xlim(0,360) pt.ylim(-1.2,1.2) pt.title("SIN function") pt.show() 04.Windows下anaconda安裝第三方包的方法小結(tensorflow、gensim為例)     開始 > 所有程式 > anaconda >anaconda prompt         第一種方法             pip install gensim         第二種方法是從官網下載支援window系統的三方包點選開啟連結             pip install 路徑+whl檔名         第三種是輸入             conda install tensorflow 05.打包成EXE     開始 > 所有程式 > anaconda >anaconda prompt         安裝打包工具:             pip install pyinstaller         建立EXE             pyinstaller C:\Users\jashliao\Desktop\temp.py –onefile [–noconsole]      PS.使用pyinstaller打包python程式時,出現如下Error訊息,UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0xb5 in position 152: invalid start byte 檔案位置:     C:\ProgramData\Anaconda3\Lib\site-packages\PyInstaller\compat.py 找到 out = out.decode(encoding) 這一行 修改成 out = out.decode(encoding,”replace”)   

本文由jashliaoeuwordpress提供 原文連結

寫了 5860316篇文章,獲得 23313次喜歡
精彩推薦