1
1
mirror of https://github.com/leon-ai/leon.git synced 2024-12-01 03:15:58 +03:00

feat: on Python dev env setup, provide Windows hint related to Microsoft C++ Build Tools

This commit is contained in:
louistiti 2022-10-07 13:24:58 +08:00
parent 061f555e11
commit 432c590ee7
No known key found for this signature in database
GPG Key ID: 7ECA3DD523793FE6

View File

@ -6,6 +6,7 @@ import { command } from 'execa'
import { PYTHON_BRIDGE_SRC_PATH, TCP_SERVER_SRC_PATH } from '@/constants'
import { LogHelper } from '@/helpers/log-helper'
import { LoaderHelper } from '@/helpers/loader-helper'
import { OSHelper, OSTypes } from '@/helpers/os-helper'
/**
* Set up development environment according to the given setup target
@ -96,6 +97,8 @@ SETUP_TARGETS.set('tcp-server', {
const installPythonPackages = async () => {
LogHelper.info(`Installing Python packages from ${pipfilePath}.lock...`)
const { type: osType } = OSHelper.getInformation()
// Delete .venv directory to reset the development environment
if (hasDotVenv) {
LogHelper.info(`Deleting ${dotVenvPath}...`)
@ -112,6 +115,13 @@ SETUP_TARGETS.set('tcp-server', {
LogHelper.success('Python packages installed')
} catch (e) {
LogHelper.error(`Failed to install Python packages: ${e}`)
if (osType === OSTypes.Windows) {
LogHelper.error(
'Please check the error above. It might be related to Microsoft C++ Build Tools. If it is, you can check here: "https://stackoverflow.com/a/64262038/1768162" then restart your machine and retry'
)
}
process.exit(1)
}