Apple M1 和其他设备上的 TensorFlow 的通用要求.txt

发布于 2025-01-18 04:00:16 字数 696 浏览 1 评论 0原文

我有一本新的MacBook和Apple M1芯片组。要安装TensorFlow,我按照说明在这里,即,安装tensorflow-tensorflow-金属tensorflow-macos而不是普通tensorflow package。

虽然工作正常,但这意味着我无法运行典型的pip install -ruesignt.txt,只要我们在supports.txt中具有tensorflow。相反,如果我们包括tensorflow-macos,它将导致非M1甚至非麦克索用户的问题。

我们的图书馆必须在所有平台上工作。是否有通用安装命令可以根据计算机是否是M1 Mac来安装正确的TensorFlow版本?这样我们就可以为每个人使用单个unigess.txt

或者,如果不可能,我们可以传递某些标志/选项,例如pip install -r unignts.txt -m1安装一些变化吗? 这里最简单,最优雅的解决方案是什么?

I have a new MacBook with the Apple M1 chipset. To install tensorflow, I follow the instructions here, i.e., installing tensorflow-metal and tensorflow-macos instead of the normal tensorflow package.

While this works fine, it means that I can't run the typical pip install -r requirements.txt as long as we have tensorflow in the requirements.txt. If we instead include tensorflow-macos, it'll lead to problems for non-M1 or even non-macOS users.

Our library must work on all platforms. Is there a generic install command that installs the correct TensorFlow version depending on whether the computer is a M1 Mac or not? So that we can use a single requirements.txt for everyone?

Or if that's not possible, can we pass some flag/option, e.g., pip install -r requirements.txt --m1 to install some variation?
What's the simplest and most elegant solution here?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

策马西风 2025-01-25 04:00:16

根据这篇文章有没有办法有条件要求。txt文件我的python应用程序基于平台?

您可以在您的需求上使用条件。

tensorflow==2.8.0; sys_platform != 'darwin' or platform_machine != 'arm64'
tensorflow-macos==2.8.0; sys_platform == 'darwin' and platform_machine == 'arm64'

According to this post Is there a way to have a conditional requirements.txt file for my Python application based on platform?

You can use conditionals on your requirements.txt, thus

tensorflow==2.8.0; sys_platform != 'darwin' or platform_machine != 'arm64'
tensorflow-macos==2.8.0; sys_platform == 'darwin' and platform_machine == 'arm64'
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文