问题描述
tflite_runtime 不在 pypi 中托管,但可以安装为:
pip3 install --extra-index-url https://google-coral.github.io/py-repo/ tflite_runtime
如何打包具有此依赖项的项目?
我已经看到了这个 setuptools docs 和一些主题 1、2,但到目前为止没有运气。
setup.cfg
[options]
...
dependency_links = https://google-coral.github.io/py-repo/tflite-runtime/
install_requires =
tflite_runtime==2.5.0
奖励:我在本地使用 mac。我的部署将在 linux 上进行。有没有办法根据操作系统安装正确的whl?
解决方法
这对我来说安装 .whl 包并使其特定于操作系统。
setup.py
import setuptools
import platform
# tflite for linux
tflite = "tflite_runtime@https://github.../tflite_runtime-...-cp37m-linux...",if platform.system() == 'Darwin':
# tflite for macos
tflite = "tflite_runtime@https://github../tflite_runtime...cp37m-macosx..."
setuptools.setup(
include_package_data=True,install_requires=[
tflite,...
]
更简洁的方法应该是使用 Environment Markers,但我无法让它发挥作用。