[Python]python安裝與打包exe
首先 安裝python(版本不要求) Python官網 可以參考此網頁安裝方式 安裝Selenium 1。開啟cmd 2。指向安裝python目錄 3。 pip install selenium 下載 webdriver Chrome & Firefox的webdriver傳送門 Firefox web driver Chrome web driver 下載完成後,將zip裡檔案解壓縮到python目錄裡。 安裝 pyinstaller 1。在cmd 2。指向安裝python目錄 3。輸入 pip install pyinstaller 第一個範例: 開新網頁,新增一個按鈕,當按下按鈕後,會開啟google首頁並自輸填入搜詢的值。 首先 HTML 建立一個html,並新增button <button onclick="open_exe('C:\\Users\\USER\\Desktop\\google.exe')">打开google</button> PYTHON 建立新檔案, 並輸入 from selenium import webdriver browser = webdriver.Chrome() browser.get('https://www.google.com/') element = browser.find_element_by_name("q"); element.send_keys('hello world'); 儲存檔案並命名為 google.py。 pyinstaller 使用方法教學 py檔案要轉成exe: 1. 開啟cmd 2. 輸入 pyinstaller -F google.py 按enter 3.在python目錄裡,找dist資料夾,就可以看到轉的exe [ 轉exe過程錯誤訊息與解法 1。 from selenium import webdriver ^ IndentationError: unexpected indent 解法: 開啟要轉exe的檔案,再次檢視 發現 from selenium impo...


留言
張貼留言