简体   繁体   English

python3 buildozer kivy ascci编解码器无法解码

[英]python3 buildozer kivy ascci codec cant decode

OS: ubuntu 16.04 作业系统:ubuntu 16.04

I am having problems deploying my kivy app to my android phone. 我在将kivy应用程序部署到Android手机时遇到问题。

when I type buildozer android_new debug deploy run in the terminal I get the error 当我在终端中输入buildozer android_new debug deploy run ,出现错误

UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 1658: orinal not in range(128) UnicodeDecodeError:'ascii'编解码器无法解码位置1658的字节0xc2:序号不在范围内(128)

does anyone know how I can fix this? 有谁知道我该如何解决?

Josh 玩笑

I recently had a similar problem when building python/kivy/buildozer environment in Docker. 我最近在Docker中构建python / kivy / buildozer环境时遇到了类似的问题。 The base image was Ubuntu 16.04, so I think it may work for you, too. 基本映像是Ubuntu 16.04,因此我认为它也可能适用于您。

In my case, locale isn't installed by default in the Ubuntu Docker image, so I had to install it with apt-get install -y locales , but I don't think you'll need to do that. 就我而言,Ubuntu Docker映像中默认未安装语言环境,因此我不得不使用apt-get install -y locales ,但我认为您不需要这样做。

First, run: 首轮:

locale -a 

This will display all of the locales available on your system. 这将显示系统上所有可用的语言环境。 If you see the locale you need listed, then use locale to see what LC_ALL and LANG are set to. 如果您看到需要列出的locale ,请使用locale查看LC_ALLLANG的设置。 If they're not set to what you need, or they are set to POSIX , then skip to step four. 如果未将它们设置为所需的值,或者将它们设置为POSIX ,则跳至第四步。

Second, generate the locale file. 其次,生成语言环境文件。 In my case, I needed the US English version; 就我而言,我需要美国英语版本; thus my command was: 因此我的命令是:

locale-gen en_US.UTF-8

If you need a different language, you'll need to look up which filename fits your needs. 如果您需要其他语言,则需要查找适合您需求的文件名。

Third, updated it like so: 第三,像这样更新它:

update-locale en_US.UTF-8

Fourth, use the following commands to update the environment variables Buildozer/Python will look for: 第四,使用以下命令更新Buildozer / Python将寻找的环境变量:

export LC_ALL=$(locale -a | grep en_US)
export LANG=$(locale -a | grep en_US)

Note that I am using grep, because I found that the locale files that end up on the local system don't always have the same extension, but the naming convention for the first part of the filename seems to be consistent. 请注意,我使用的是grep,因为我发现以本地系统结尾的语言环境文件不一定总是具有相同的扩展名,但是文件名第一部分的命名约定似乎是一致的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM