importplatformdefread_file(filename):ifplatform.system()=="Darwin":# macOS onlyfromAppKitimportNSBundlereturn[DoyourfancyNSBundlestuffhere]else:# Otherwise just load the usual waywithopen(filename,"r")asf:returnf.read() Then callread_file()whenever you need it. Member bwoodsendcommentedAug 3...
python setup.py build python setup.py install 安装之后,并不能直接打包,需要在源码中导入几个模块,否则可能会报错:...| 即可打包。...p 添加需要打包的 .py.py.py 文件,通过 −−hidden−import--hidden-import−−hidden−import 引入自建模块,注意不能打包资源文件,打包成功后会生成 buildbu...
conda create -ntestyaml numpysourceactivatetestpip install pyinstaller cat<<SCRIPT> hello-world.pyimport yamlimport numpyprint('Hello from the bundle!')print('YAML version: ' + yaml.__version__)print('Numpy version: ' + numpy.__version__)SCRIPTSITE_PACKAGES="$HOME/miniconda3/envs/test/lib...