python 3.8.10
Python's ease of learning, powerful capabilities, and wide range of applications have made this language widely used. This document will introduce how to integrate a Python project into a desktop application.
Preparation
- Download the project
bash
# gitee
git clone https://gitee.com/dromara/electron-egg.git
# github
git clone https://github.com/dromara/electron-egg.git- Switch to the
demobranch
bash
git checkout -b demo-python remotes/origin/demo- Install
frontend,Electron, andPythondependencies
bash
# Install Electron dependencies in the root directory
npm i
# Enter the frontend directory and install dependencies
cd ./frontend
npm i
# Install Python dependencies
cd ./python
pip install -r requirements.txtBuild Python Program
Note: When using conda, be aware of the following
You need to configure the Python location in bin.js based on the result returned by where python, and cx_Freeze should be installed using conda install -c conda-forge cx_freeze
bash
# Install cx_Freeze, which can generate executable programs
pip install cx_Freeze
# Build Python program
npm run build-pythonRun
bash
npm run startCheck the cross menu in the demo for the Python service.
