Python3Android 311.22.1.19
dotnet add package Python3Android --version 311.22.1.19
NuGet\Install-Package Python3Android -Version 311.22.1.19
<PackageReference Include="Python3Android" Version="311.22.1.19" />
<PackageVersion Include="Python3Android" Version="311.22.1.19" />
<PackageReference Include="Python3Android" />
paket add Python3Android --version 311.22.1.19
#r "nuget: Python3Android, 311.22.1.19"
#:package Python3Android@311.22.1.19
#addin nuget:?package=Python3Android&version=311.22.1.19
#tool nuget:?package=Python3Android&version=311.22.1.19
Python3Android
A NuGet package that provides Python 3.11.13 runtime for Android applications. This package allows you to run Python code directly in your Maui Android applications.
Installation
Add the package to your .NET Android project using the NuGet Package Manager:
<PackageReference Include="Python3Android" Version="311.22.1.14" />
Or install via the Package Manager Console:
Install-Package Python3Android
Package Version Numbering
Python_Version.Min_Android_Framework.Package_Version
Python versions are squashed, so python 3.8 becomes 38. (Future: 3.10 → 310, 4.0 → 400)
Min_Android_Frame work is the minimum android framework that the Maui application must target. 22 is Android 5.1.
Requirements
- .NET 9.0 or later
- Android API 22 or later
- .NET MAUI project
Usage
Here's a simple example of how to run Python code in your Android application:
using Python3Android;
public class PythonExample
{
public async Task RunPythonCode()
{
// Install Python environment
var androidPythonEnvironment = await AndroidPythonEnvironment.Create();
// Run Python code
string pythonCode = @"
def greet(name):
return f'Hello, {name}!'
result = greet('Android')
print(result)
";
string result = androidPythonEnvironment.RunCode(pythonCode);
Console.WriteLine(result); // Outputs: Hello, Android!
}
}
Features
- Includes Python 3.11.13 runtime for Android
- Native library support (.so files)
- Python standard library included (python311.zip)
- Compatible with Android API 22 and later
Package Contents
The package includes:
- Native Python libraries (.so files)
- Python standard library (python311.zip)
- Build targets for proper integration
Notes
- The Python runtime is automatically included in your Android application's assets
- You need to call
await AndroidPythonEnvironment.Create()
to get a initialized AndroidPythonEnvironment instance which allows running Python code - The Python environment only needs to be installed once per app session.
- AndroidPythonEnvironment.Create() will only run the install, if not already installed, or the nuget package has been updated. (So it's safe to run each time your app starts.)
License
This package is provided under the terms of the Python Software Foundation License.
Author
Created by hindlemail
Repository
Source code available at: https://hg.sr.ht/~hindlemail/PythonAndroidNuget
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net9.0-android35.0 is compatible. net10.0-android was computed. |
-
net9.0-android35.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
311.22.1.19 | 174 | 7/30/2025 |
311.22.1.18 | 191 | 7/30/2025 |
311.22.1.17 | 190 | 7/29/2025 |
310.22.1.14 | 358 | 7/25/2025 |
38.22.1.12 | 150 | 7/15/2025 |
38.22.1.10 | 212 | 5/16/2025 |
38.22.1.9-alpha | 188 | 5/16/2025 |
3.8.10-22-1.8 | 208 | 5/15/2025 |
3.8.10-22-1.0 | 216 | 5/12/2025 |