File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -294,36 +294,19 @@ print_header "步骤 7/7: 验证 PyCANDYAlgo"
294294print_step " 测试导入..."
295295
296296# 测试 PyCANDYAlgo 导入
297- IMPORT_TEST=$( python3 << 'PYEOF '
298- import sys
299- try:
300- import PyCANDYAlgo
301- print(f"VERSION:{PyCANDYAlgo.__version__}")
302- print("SUCCESS")
303- except Exception as e:
304- print(f"ERROR:{e}")
305- sys.exit(1)
306- PYEOF
307- )
308-
309- if echo " $IMPORT_TEST " | grep -q " SUCCESS" ; then
310- VERSION=$( echo " $IMPORT_TEST " | grep " VERSION:" | cut -d: -f2)
311- print_success " PyCANDYAlgo 导入成功 (版本: $VERSION )"
297+ if python3 -c " import PyCANDYAlgo; print('VERSION:', PyCANDYAlgo.__version__)" 2>&1 ; then
298+ print_success " PyCANDYAlgo 导入成功"
312299else
313300 print_error " PyCANDYAlgo 导入失败"
314- echo " $IMPORT_TEST "
301+ # 显示详细错误
302+ python3 -c " import PyCANDYAlgo" 2>&1 || true
315303 exit 1
316304fi
317305
318306# 测试核心依赖
319307print_step " 测试核心依赖..."
320- for pkg in numpy torch; do
321- if python3 -c " import $pkg " 2> /dev/null; then
322- print_success " $pkg 可用"
323- else
324- print_error " $pkg 不可用"
325- fi
326- done
308+ python3 -c " import numpy; print('numpy:', numpy.__version__)" || print_warning " numpy 不可用"
309+ python3 -c " import torch; print('torch:', torch.__version__)" || print_warning " torch 不可用"
327310
328311# ============================================================================
329312# 完成
You can’t perform that action at this time.
0 commit comments