小编Ida*_*anB的帖子

Docker Alpine 构建在 mysqlclient 安装上失败,并出现错误:异常:找不到有效的 pkg-config 名称

我在使用基于 Python 的 Dockerfile 构建 Docker 映像时遇到问题。我正在尝试使用 mysqlclient 库(版本 2.2.0)和 Django(版本 4.2.2)。这是我的 Dockerfile:

FROM python:3.11-alpine
WORKDIR /usr/src/app
COPY requirements.txt .
RUN apk add --no-cache gcc musl-dev mariadb-connector-c-dev && \
    pip install --no-cache-dir -r requirements.txt
COPY . .
CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"]
Run Code Online (Sandbox Code Playgroud)

当 Docker 构建过程到达安装 mysqlclient 包时就会出现问题。我收到以下错误:异常:找不到有效的 pkg-config 名称 为了解决此问题,我尝试将 pkgconfig 添加到 apk add 命令,不幸的是,这没有帮助,并且仍然存在相同的错误。

如果您能提供有关如何解决此问题的指导,我将不胜感激。

先感谢您。

python docker mysql-connector-python alpine-linux

22
推荐指数
5
解决办法
3万
查看次数

使用BluetoothManager和getAdapter()

我正在 Kotlin 中开发 Android 应用程序,我正在尝试在我的应用程序中获取用于蓝牙通信的蓝牙适配器。

我已阅读此文档:设置蓝牙

如图所示,我需要编写以下代码来获取适配器:

val bluetoothAdapter: BluetoothAdapter? = BluetoothAdapter.getDefaultAdapter()
if (bluetoothAdapter == null) {
  // Device doesn't support Bluetooth
}
Run Code Online (Sandbox Code Playgroud)

当我在 Android Studio 中编写此内容时,我收到以下警告:

'getDefaultAdapter(): BluetoothAdapter!' is deprecated. Deprecated in Java
...
Deprecated: this method will continue to work, but developers are 
strongly encouraged to migrate to using BluetoothManager.getAdapter(), since that 
approach enables support for Context.createAttributionContext.
Run Code Online (Sandbox Code Playgroud)

我尝试使用像这样的新推荐方式

var bluetoothManager = (BluetoothManager)(Context.getSystemService(Context.BLUETOOTH_SERVICE))
var adapter = bluetoothManager.getAdapter()
Run Code Online (Sandbox Code Playgroud)

我在代码中收到此错误:

Unresolved reference: getSystemService
Run Code Online (Sandbox Code Playgroud)

我尝试了多种方法来实现它 - 没有任何效果。

我很乐意得到一些帮助。

请指教。

谢谢

android bluetooth kotlin android-studio android-bluetooth

4
推荐指数
1
解决办法
4065
查看次数