8wDlpd.png
8wDFp9.png
8wDEOx.png
8wDMfH.png
8wDKte.png

在 Ubuntu 上尝试将 Python 和 .kv 代码转换为 APK 文件时出现问题

Sara tabaghchi 2月前

44 0

这是我收到的错误。我使用的是 Ubuntu 24.04,我有一个简单的 Kivy 应用程序,其中包含一个 main.py 文件和 my.kv 文件。我也有 buildozer.spec 文件,但是当我需要获取 APK 时...

这是我收到的错误。我使用的是 Ubuntu 24.04,我有一个简单的 Kivy 应用程序,其中包含一个 main.py 文件和 my.kv 文件。我也有 buildozer.spec 文件,但是当我需要获取 APK 文件时,会弹出以下错误。

ish@ish-VirtualBox:~/kivyproject$ buildozer -v android debug
# Ensure build layout
# Create directory /home/ish/kivyproject/bin
# Check configuration tokens
# Preparing build
# Check requirements for android
# Search for Git (git)
#  -> found at /usr/bin/git
# Search for Cython (cython)
#  -> found at /usr/local/bin/cython
# Search for Java compiler (javac)
#  -> found at /usr/bin/javac
# Search for Java keytool (keytool)
#  -> found at /usr/bin/keytool
# Install platform
# Run 'git config --get remote.origin.url' ...
# Cwd /home/ish/kivyproject/.buildozer/android/platform/python-for-android
https://github.com/kivy/python-for-android.git
# Run 'git branch -vv' ...
# Cwd /home/ish/kivyproject/.buildozer/android/platform/python-for-android
* master 957a3e5f [origin/master] Merge pull request #2959 from kivy/release-2024.01.21
# Run '/usr/bin/python3 -m pip install -q --user appdirs colorama>=0.3.3 jinja2 sh>=1.10, <2.0; sys_platform!="win32" build toml packaging setuptools' ...
# Cwd None
error: externally-managed-environment

× This environment is externally managed
> To install Python packages system-wide, try apt install
    python3-xyz, where xyz is the package you are trying to
    install.
    
    If you wish to install a non-Debian-packaged Python package,
    create a virtual environment using python3 -m venv path/to/venv.
    Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
    sure you have python3-full installed.
    
    If you wish to install a non-Debian packaged Python application,
    it may be easiest to use pipx install xyz, which will manage a
    virtual environment for you. Make sure you have pipx installed.
    
    See /usr/share/doc/python3.12/README.venv for more information.

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.
# Command failed: ('/usr/bin/python3', '-m', 'pip', 'install', '-q', '--user', 'appdirs', 'colorama>=0.3.3', 'jinja2', 'sh>=1.10, <2.0; sys_platform!="win32"', 'build', 'toml', 'packaging', 'setuptools')
# Error code: 1
# ENVIRONMENT:
#     SHELL = '/bin/bash'
#     SESSION_MANAGER = 'local/ish-VirtualBox:@/tmp/.ICE-unix/2059,unix/ish-VirtualBox:/tmp/.ICE-unix/2059'
#     QT_ACCESSIBILITY = '1'
#     COLORTERM = 'truecolor'
#     XDG_CONFIG_DIRS = '/etc/xdg/xdg-ubuntu:/etc/xdg'
#     XDG_MENU_PREFIX = 'gnome-'
#     GNOME_DESKTOP_SESSION_ID = 'this-is-deprecated'
#     GNOME_SHELL_SESSION_MODE = 'ubuntu'
#     SSH_AUTH_SOCK = '/run/user/1000/keyring/ssh'
#     MEMORY_PRESSURE_WRITE = 'c29tZSAyMDAwMDAgMjAwMDAwMAA='
#     XMODIFIERS = '@im=ibus'
#     DESKTOP_SESSION = 'ubuntu'
#     GTK_MODULES = 'gail:atk-bridge'
#     DBUS_STARTER_BUS_TYPE = 'session'
#     PWD = '/home/ish/kivyproject'
#     LOGNAME = 'ish'
#     XDG_SESSION_DESKTOP = 'ubuntu'
#     XDG_SESSION_TYPE = 'wayland'
#     SYSTEMD_EXEC_PID = '2059'
#     XAUTHORITY = '/run/user/1000/.mutter-Xwaylandauth.P7LQP2'
#     HOME = '/home/ish'
#     USERNAME = 'ish'
#     IM_CONFIG_PHASE = '1'
#     LANG = 'en_US.UTF-8'
#     LS_COLORS = 'rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=00:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.avif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.webp=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:*~=00;90:*#=00;90:*.bak=00;90:*.crdownload=00;90:*.dpkg-dist=00;90:*.dpkg-new=00;90:*.dpkg-old=00;90:*.dpkg-tmp=00;90:*.old=00;90:*.orig=00;90:*.part=00;90:*.rej=00;90:*.rpmnew=00;90:*.rpmorig=00;90:*.rpmsave=00;90:*.swp=00;90:*.tmp=00;90:*.ucf-dist=00;90:*.ucf-new=00;90:*.ucf-old=00;90:'
#     XDG_CURRENT_DESKTOP = 'ubuntu:GNOME'
#     MEMORY_PRESSURE_WATCH = '/sys/fs/cgroup/user.slice/user-1000.slice/[email protected]/app.slice/app-gnome\\x2dsession\\x2dmanager.slice/[email protected]/memory.pressure'
#     VTE_VERSION = '7600'
#     WAYLAND_DISPLAY = 'wayland-0'
#     GNOME_TERMINAL_SCREEN = '/org/gnome/Terminal/screen/6009e977_7532_431a_acea_9dd366fa6227'
#     GNOME_SETUP_DISPLAY = ':1'
#     LESSCLOSE = '/usr/bin/lesspipe %s %s'
#     XDG_SESSION_CLASS = 'user'
#     TERM = 'xterm-256color'
#     LESSOPEN = '| /usr/bin/lesspipe %s'
#     USER = 'ish'
#     GNOME_TERMINAL_SERVICE = ':1.105'
#     DISPLAY = ':0'
#     SHLVL = '1'
#     GSM_SKIP_SSH_AGENT_WORKAROUND = 'true'
#     QT_IM_MODULE = 'ibus'
#     DBUS_STARTER_ADDRESS = 'unix:path=/run/user/1000/bus,guid=0a88ef8a0bb0368fc5548f4f6673fcd1'
#     XDG_RUNTIME_DIR = '/run/user/1000'
#     DEBUGINFOD_URLS = 'https://debuginfod.ubuntu.com '
#     XDG_DATA_DIRS = '/usr/share/ubuntu:/usr/share/gnome:/usr/local/share/:/usr/share/:/var/lib/snapd/desktop'
#     PATH = '/home/ish/.buildozer/android/platform/apache-ant-1.9.4/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin:/home/ish/.local/bin/'
#     GDMSESSION = 'ubuntu'
#     DBUS_SESSION_BUS_ADDRESS = 'unix:path=/run/user/1000/bus,guid=0a88ef8a0bb0368fc5548f4f6673fcd1'
#     _ = '/usr/local/bin/buildozer'
# 
# Buildozer failed to execute the last command
# The error might be hidden in the log above this error
# Please read the full log, and search for it before
# raising an issue with buildozer itself.
# In case of a bug report, please add a full log with log_level = 2

我从早上 8 点开始就一直在尝试解决这个问题,现在已经是下午 3 点了,所以可以肯定地说我尝试了很多。我尝试了很多不同的独特方法,但最终还是遇到了同样的问题。我尝试使用 Ubuntu、Google Colab 和 GitHub 来解决这个问题,但每次都遇到同样的错误。

这是我的第一个 Stack Overflow 问题,因此如有必要,请随时告诉我添加任何信息。

谢谢。

帖子版权声明 1、本帖标题:在 Ubuntu 上尝试将 Python 和 .kv 代码转换为 APK 文件时出现问题
    本站网址:http://xjnalaquan.com/
2、本网站的资源部分来源于网络,如有侵权,请联系站长进行删除处理。
3、会员发帖仅代表会员个人观点,并不代表本站赞同其观点和对其真实性负责。
4、本站一律禁止以任何方式发布或转载任何违法的相关信息,访客发现请向站长举报
5、站长邮箱:yeweds@126.com 除非注明,本帖由Sara tabaghchi在本站《ubuntu》版块原创发布, 转载请注明出处!
最新回复 (0)
  • 我正在尝试运行 Block-STM 的台架测试,但一直遇到此错误:错误:无法运行“librocksdb-sys v6.20.3”的自定义构建命令,原因:进程未成功退出……

    的台架测试 Block-STM ,但一直遇到此错误:

    error: failed to run custom build command for `librocksdb-sys v6.20.3`
    
    Caused by:
      process didn't exit successfully: `/home/ubuntu/Block-STM/target/release/build/librocksdb-sys-06f571cb87f75164/build-script-build` (exit status: 101)
      --- stderr
      thread 'main' panicked at '"enum_(unnamed_at_rocksdb/include/rocksdb/c_h_854_1)" is not a valid Ident', /home/ubuntu/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-1.0.36/src/fallback.rs:708:9
      note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
    

    我尝试安装 clang,下载并重建 rust-rocksdb,甚至安装了 ubuntu 的开发包。

    $ sudo apt-get install librocksdb-dev
    

    什么都没起作用。

    非常感谢任何帮助。

  • 我正在尝试在我的服务器上使用 apache2 配置 varnish cache 7。虽然设置 http 请求工作正常。但 varnish 无法直接处理 https,所以我尝试了 Apache 和 Hitch,但没有成功...

    我正在尝试在我的服务器上使用 apache2 配置 varnish cache 7。虽然设置 http 请求工作正常。但 varnish 无法直接处理 https,因此我尝试了 Apache 和 Hitch,但没有成功。现在,如果有人能帮我找到仅适用于 varnish 和 Apache 的工作配置。我的另一个问题是,我必须使用两个虚拟主机吗? 在此处输入图像描述

    ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    Apache HTTP Host 
    ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    
    
    <VirtualHost *:8080>
        ServerName mycloud.com
        #ServerAdmin webmaster@localhost
        DocumentRoot /var/www/mycloud.com
    
        <Directory var/www/mycloud.com>
                    Options Indexes FollowSymLinks
                    AllowOverride All
                    Order allow,deny
                    allow from all
        </Directory>
        
        
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined    
        
    
    </VirtualHost>
    
    
    ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    Apache HTTPS Host 
    ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    
    
    <IfModule mod_ssl.c>
    <VirtualHost *:443>
    
        ServerName mycloud.com
        
        DocumentRoot /var/www/mycloud.com
        
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
    
        Include /etc/letsencrypt/options-ssl-apache.conf
        SSLCertificateFile /etc/letsencrypt/live/mycloud.com/fullchain.pem
        SSLCertificateKeyFile /etc/letsencrypt/live/mycloud.com/privkey.pem
        
        # Set up proxy headers
        ProxyRequests Off
        ProxyPreserveHost On
        ProxyAddHeaders On
        
        SSLProxyEngine On
        SSLProxyCheckPeerCN on
        SSLProxyCheckPeerExpire on
       
         # Add headers to prevent redirect loops
        RequestHeader set X-Forwarded-Proto "https"
        RequestHeader set X-Forwarded-Port "443"
       
        # Optional: Log forwarding headers for debugging
        LogLevel debug
        Header add X-Forwarded-Proto "https" env=HTTPS
        Header add X-Forwarded-Port "443" env=HTTPS
        
        ProxyPass /test http://127.0.0.1:80
        ProxyPassReverse /test http://127.0.0.1:80
          
    
    </VirtualHost>
    </IfModule>
    
    
    ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    Varnish VLC
    ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    
    vcl 4.0;
    
    backend default {
        .host = "127.0.0.1";
        .port = "8080";
    }
    
    sub vcl_recv {
        if (req.http.X-Forwarded-Proto ~ "https") {
            set req.http.X-Forwarded-Proto = "https";
        }
    }
    
    sub vcl_backend_response {
        set beresp.http.X-Varnish = bereq.http.X-Varnish;
    }
    
    sub vcl_deliver {
        if (obj.hits > 0) {
            set resp.http.X-Cache = "HIT";
            set resp.http.X-Cache-Hits = obj.hits;
        } else {
            set resp.http.X-Cache = "MISS";
        }
    }
    
    ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    Varnish Service 
    ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    
    [Unit]
    Description=Varnish Cache, a high-performance HTTP accelerator
    Documentation=https://www.varnish-cache.org/docs/ man:varnishd
    
    [Service]
    Type=simple
    
    # Maximum number of open files (for ulimit -n)
    LimitNOFILE=131072
    
    # Locked shared memory - should suffice to lock the shared memory log
    # (varnishd -l argument)
    # Default log size is 80MB vsl + 1M vsm + header -> 82MB
    # unit is bytes
    LimitMEMLOCK=85983232
    ExecStart=/usr/sbin/varnishd \
              -j unix,user=vcache \
              -F \
              -a :80 \
              -a localhost:6092,PROXY \
              -p feature=+http2 \
              -f /etc/varnish/default.vcl \
              -s malloc,256m
    
    ExecReload=/usr/share/varnish/varnishreload
    ProtectSystem=full
    ProtectHome=true
    PrivateTmp=true
    PrivateDevices=true
    
    [Install]
    WantedBy=multi-user.target
    
    

    我尝试使用 Hitch 终止 TLS,但配置对我来说太复杂了。所以没有成功。

  • 虽然我无法真正帮助您处理 Apache TLS 代理部分,但我可以帮助您安装和配置 Hitch。

    如果您需要 Varnish 是因为您的 Apache Web 服务器上有太多请求,那么最好避免使用 Apache 来处理 TLS 终止。

    让我们从快速安装指南开始,该指南基于 我们的官方教程 .

    在 Debian 或 Ubuntu 上安装 Hitch

    如果您计划在 Debian 或 Ubuntu 系统上运行 Varnish 和 Hitch,请运行以下命令来准备安装:

    sudo apt-get update
    sudo apt-get install debian-archive-keyring curl gnupg apt-transport-https
    curl -s -L https://packagecloud.io/varnishcache/hitch/gpgkey | sudo apt-key add -
    

    然后运行以下命令连接到我们的自定义包存储库:

    . /etc/os-release
    sudo tee /etc/apt/sources.list.d/hitch.list > /dev/null <<-EOF
    deb https://packagecloud.io/varnishcache/hitch/$ID/ $VERSION_CODENAME main
    EOF
    sudo tee /etc/apt/preferences.d/hitch > /dev/null <<-EOF
    Package: hitch
    Pin: release o=packagecloud.io/varnishcache/*
    Pin-Priority: 1000
    EOF
    
    

    此后只需更新和安装:

    sudo apt-get update
    sudo apt-get install hitch
    

    在 Red Hat 或 Centos 系统上安装 Hitch

    如果您使用 Red Hat 或 Centos 版本安装 Hitch,只需运行以下命令来准备安装:

    . /etc/os-release
    sudo tee /etc/yum.repos.d/hitch.repo > /dev/null <<-EOF
    [varnishcache_hitch]
    name=varnishcache_hitch
    baseurl=https://packagecloud.io/varnishcache/hitch/el/${VERSION_ID%%.*}/$(arch)
    repo_gpgcheck=0
    gpgcheck=0
    enabled=1
    gpgkey=https://packagecloud.io/varnishcache/hitch/gpgkey
    sslverify=1
    sslcacert=/etc/pki/tls/certs/ca-bundle.crt
    metadata_expire=300
    EOF
    

    然后只需运行 sudo yum install hitch 即可安装 Hitch。

    配置 Hitch

    Hitch 的代理和 TLS 配置位于 /etc/hitch/hitch.conf .

    这是一个示例配置:

    frontend = "[*]:443"
    daemon = on
    user = "hitch"
    group = "hitch"
    backend = "[localhost]:6092"
    pem-dir = "/etc/hitch/cert.d"
    pem-dir-glob = "*.pem"
    pem-file = "/etc/hitch/cert.pem"
    alpn-protos = "h2, http/1.1"
    write-proxy-v2 = on
    

    我注意到,在您的 Varnish 的 systemd 配置中,该端口 6092 被配置为 PROXY 流量的监听端口。这是理想的:我 6092 在后端配置中引用了该配置,并通过设置启用了到 Varnish 的 PROXY 流量 write-proxy-v2 = on

    事实上,您已经通过 -p feature=+http2 运行时参数启用了 HTTP/2 支持,这使得我们可以在 Hitch 中进行设置 alpn-protos = "h2, http/1.1" 以强制执行 HTTP/2 流量。

    那么证书呢?

    根据文件中的说明 hitch.conf ,证书存储在 /etc/hitch/cert.d 文件夹中。请将您的 .pem 文件放在该文件夹中。

    证书必须有 .pem 扩展名,Hitch 才能接收。这是通过设置配置的 pem-dir-glob = "*.pem" 。您可以随意更改。

    如果您想从另一个文件夹加载证书,只需更新 pem-dir = "/etc/hitch/cert.d" 设置。

    当您更改设置时,不要忘记运行 sudo systemctl restart hitch。

    在 Varnish 中检测 HTTPS 流量

    Hitch 是一个纯粹的 TLS 代理,没有真正的 HTTP/HTTPS 感知能力。 X-Forwarded-Proto 可以使用它来创建这种感知能力并将其传达给后端服务。

    与您的 Apache 示例不同,我们无法 X-Forwarded-Proto 在 TLS 代理中设置标头,因为 Hitch(如上所述)不具备该 HTTP 感知能力。

    但是,我们可以使用来自 PROXY 协议的信息来确定连接是否通过 TLS 完成。

    这是一个非常简单的 VCL 片段,您可以将其包含在您自己的 VCL 配置中:

    vcl 4.1;
    
    import proxy;
    
    backend default {
        .host = "127.0.0.1";
        .port = "8080";
    }
    
    sub vcl_recv {
        if(!req.http.X-Forwarded-Proto) {
            if (proxy.is_ssl()) {
                set req.http.X-Forwarded-Proto = "https";
            } else {
                set req.http.X-Forwarded-Proto = "http";
            }
        }    
    }
    
    sub vcl_hash {
        hash_data(req.http.X-Forwarded-Proto);
    }
    

    如您所见,该 proxy.is_ssl() 函数用于从 PROXY 连接中获取潜在的 TLS 信息。如果函数返回 true ,我们就知道这是一个 HTTPS 请求,并相应地设置 X-Forwarded-Proto 标头。

    您的应用程序还将使用该标头来为超链接创建正确的 URL 方案。由于我们将该标头的值添加到缓存哈希中,因此 Varnish 将分别存储对象的 HTTP 和 HTTPS 变体。

返回
作者最近主题: