skywind3000 / skywind3000/PyStand

在脚本中启动新进程运行python

Open
#74 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
1.2k
Forks
146
PR merge metrics
No merged PRs in 30d

Description

PyStand.int 做如下修改

import os
import sys
import subprocess

print(123)

subprocess.run('python --version')
os.system('python --version')
os.system('python -m site')

print(sys.path)

PyStand.exe 重新编译了,而且启动了console模式,上面的运行结果只有123sys.path被打印了,中间的没有,但是我用runtime里面的python运行上面的脚本都是可以打印的

我在两台电脑上做了测试,一台是本地已经安装了Python,环境变量中有python路径的。另一台是虚拟机,没有安装过python。

在已经安装了python的电脑上 python -m site 返回的sys.path结果中是包含环境变量中的python的;没有安装python的电脑上,没有返回结果,甚至os.system('python xx.py') 也没有运行结果

正常逻辑来说,在一个python的运行时中启动另一个python进程,如果没有指定路径,那么则应该还是使用原来python的环境

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the PyStand.int entry point and reproduce the script in the console build on systems with and without Python installed. Compare subprocess.run, os.system, and python -m site with the bundled runtime; done means these commands consistently launch the intended Python environment and produce their expected output.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.