如何在 virtualenv 下运行构建器?



我正在尝试使用Buildozer从用Python 3.5编写的Kivy项目构建APK。一切都安装在虚拟环境中。当我运行时:

buildozer -v android debug

我收到以下错误:

Can not perform a '--user' install. User site-packages are not visible in this virtualenv.
# Command failed: pip install -q --user "appdirs" "colorama>=0.3.3" "sh>=1.10" "jinja2" "six"
# 
# 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

我知道标志--user在虚拟环境中没有意义。可能,默认情况下,Buildozer 不在 virtualenv 下工作。有没有办法对Buildozer说跳过这个标志?或者也许有不同的解决方案?

感谢您的提前。

似乎是构建器的已知问题。我的解决方案是在虚拟环境中将pip重命名为pip.real,并将pip替换为从参数中删除--user并将参数传递给pip.real的 shell 脚本。像这样的东西,但不完全是。可能是这样的:

#! /bin/sh
args=''
for arg in "$@"; do
[ "$arg" == "--user" ] || args="$args $arg"
done
exec pip.real "$args

最新更新