Pin-Jiun / Python

Python Document
0 stars 0 forks source link

34-Embedded Python #34

Open Pin-Jiun opened 1 year ago

Pin-Jiun commented 1 year ago

Embedded Python

可以簡單的快速執行其他版本不需安裝

選好版本後, 將zip(python-3.8.10-embed-amd64.zip)檔案解壓縮

解壓縮完畢後, 確認檔案位置切換到含有python.exe的位置 (cd)

執行方式

python.exe xxxxx.py

image


pip安裝

Embedded Python裡面不含pip套件, 需自行安裝

去到https://pip.pypa.io/en/stable/installation/ 尋找

Download the script, from https://bootstrap.pypa.io/get-pip.py.

將python38._pth的import site註解取消掉(安裝pip之前就要用) image

將檔案儲存並執行執行 image

image

用cmd cd到python-embedded\Scripts下執行pip.exe 安裝package(.whl文件同理, 有網路可以只用pip安裝所需檔案)

pip install opencv-python
pip install matplotlib

tkinter的安裝

需要在64位元環境執行

位置:完整版python路徑\Lib\tkinter 複製到:python-embedded\python37.zip

image

將完整版python路徑\dll資料夾下的_tkinter.pyd和 tcl86t.dll以及tk86t.dll 以及完整版python路徑下的tcl資料夾

image

共以上四個檔案複製至含有.exe的資料夾 image

https://zhuanlan.zhihu.com/p/77028265 https://zhuanlan.zhihu.com/p/77317765