python - UserWarning : Starting from version 2. 2.1,macOS 发行轮中的库文件由 Apple Clang (Xcode_8.3.3) 编译器构建

标签 python macos machine-learning visual-studio-code

我在我的 Windows 机器中使用 lightgbm 算法和 fastapi 构建了一个预测应用程序,当时我的应用程序完全 100% 运行。直到,我更改为 mac 机器并尝试再次运行该应用程序并收到此消息:

/Users/bhaskoromuthohar/dev/cm/credit-scoring/.venv/lib/python3.7/site-packages/lightgbm/__init__.py:48: UserWarning: Starting from version 2.2.1, the library file in distribution wheels for macOS is built by the Apple Clang (Xcode_8.3.3) compiler.
This means that in case of installing LightGBM from PyPI via the ``pip install lightgbm`` command, you don't need to install the gcc compiler anymore.
Instead of that, you need to install the OpenMP library, which is required for running LightGBM on the system with the Apple Clang compiler.
You can install the OpenMP library by the following command: ``brew install libomp``.
  "You can install the OpenMP library by the following command: ``brew install libomp``.", UserWarning)
我尝试使用 brew 安装 libomp 并执行 pip install lightgbm 但仍然无法完美运行我的应用程序。
enter image description here
P.s:我是mac环境的新手

最佳答案

请参见:
https://github.com/microsoft/LightGBM/issues/1933
https://github.com/microsoft/LightGBM/issues/1898
特别是:
https://github.com/microsoft/LightGBM/issues/1898#issuecomment-455024936
正如贡献者在这些线程中提到的那样,警告并不一定意味着您没有安装 lightgbm,但表明他们最近更改了用于构建轮子的编译器。
例如您遇到的错误很可能不是由此引起的。如果您更详细地描述您遇到的错误以及无效的错误,我将更新我的答案。
然而,由于目前的答案是制定出来的,它使您相信您对收到的警告感到吃惊,并且您将其视为错误( 我很可能是错误的,这就是为什么欢迎提供更多详细信息的原因 )
如果您无法运行您的代码并且实际上有与 lightgbm 相关的错误,您可以尝试以下操作:

pip install wheel

pip install libomp

brew link libomp
如果未搜索/usr/local,您可能需要确保可以发现 lib 和 include 目录:
-L/usr/local/opt/libomp/lib -I/usr/local/opt/libomp/include

关于python - UserWarning : Starting from version 2. 2.1,macOS 发行轮中的库文件由 Apple Clang (Xcode_8.3.3) 编译器构建,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63201587/

相关文章:

python - 数据框列到字典的字典中

python - 如何在自定义包中运行Python代码?

python - 合并排序查询集 - django

java - 将 Java 1.6 设置为 Mac OS X 10.5.8 上的默认设置

python - 在python中找到最后一个午夜时间戳

c++ - Q共享库中的应用程序

java - 升级到macOS Big Sur v11.0.1后的JAVA_HOME错误

python - Xgboost绘图树错误: Unable to parse node: 0:[petal

python - 你需要在 sklearn 中缩放 Vectorizers 吗?

python - 在 KMeans 聚类(scikit 学习)之后查找聚类的长度(与聚类相关联的点数)