我創建了一個 python 工具并想通過 brew 安裝它。當我只有一個名為 myTool 的 python 檔案時,創建公式一開始效果很好。然后我將代碼分成更多的檔案,因為它變得更大更復雜。
我如何設定安裝以捆綁這些檔案,因為現在匯入失敗,因為找不到其他檔案。
我當前的安裝
def install
bin.install 'myTool'
end
運行 brew 安裝工具時顯示的錯誤
from myModule import someFunc, someOtherFunc ModuleNotFoundError: No module named 'myModule'
uj5u.com熱心網友回復:
當前設定僅安裝該angler檔案而不安裝任何其他 python 模塊。這會導致ModuleNotFoundError錯誤。這是我的建議:
def install
# Determines the python version being used
# e.g. If python3.10, xy = 3.10
xy = Language::Python.major_minor_version "python3"
# Where to install the python files
packages = libexec/"lib/python#{xy}/site-packages/angler"
# For each file present, install them in the right location
%w[angler anglerEnums.py anglerGen.py anglerHelperFunctions.py].each do |file|
packages.install file
end
# Create a symlink to the angler python file
bin.install_symlink packages/"angler"
end
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/427986.html
上一篇:py加載后關閉終端視窗并更改圖示
下一篇:Stylelint跳過整個檔案夾
