代码拉取完成,页面将自动刷新
import platform
import subprocess
import time
DEBUG_FEATURE_FLAG = False
JIEBA_LIB_DIR = 'jieba;jieba' if platform.system() == 'Windows' else 'jieba:jieba'
def installer():
print('[INFO] Checking System State...', end='')
if platform.system() == 'Darwin' or platform.system() == 'Windows':
print('ok.')
print('[INFO] Downloading requirements', end='')
p = subprocess.Popen(
['pip', 'install', '-r', 'requirements.txt', '-i',
'https://pypi.tuna.tsinghua.edu.cn/simple/'], stdout=subprocess.DEVNULL)
while True:
if p.poll() is None:
time.sleep(0.1)
print('.', end='')
continue
if p.poll() != 0:
print('[ERROR] Failed to install requirements!')
break
print('ok.')
print('[INFO] Building project', end='')
if DEBUG_FEATURE_FLAG:
p = subprocess.Popen(
['pyinstaller', '-F', 'main.py', '--hidden-import', 'jieba',
'--add-data', JIEBA_LIB_DIR])
else:
p = subprocess.Popen(
['pyinstaller', '-F', '--noconsole', 'main.py', '--hidden-import', 'jieba',
'--add-data', JIEBA_LIB_DIR])
while True:
if p.poll() is None:
time.sleep(0.1)
print('.', end='')
continue
break
print('ok. See binary file at dist/')
if platform.system() == 'Darwin':
subprocess.Popen(['chmod', '+x', 'dist/main'], stdout=subprocess.DEVNULL)
else:
print('[ERROR] Your platform is not supported yet!')
if __name__ == '__main__':
installer()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。