File tree Expand file tree Collapse file tree
nxt_editor/integration/unreal/Content/Python Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22import sys
33import unreal
44import subprocess
5+ from pathlib import Path
56from functools import wraps
67
78
@@ -37,12 +38,23 @@ def is_nxt_available():
3738 return False
3839
3940def get_python_exc_path ():
41+ sys_exe = Path (sys .executable )
4042 exc_name = 'python'
43+ platform = 'Mac'
4144 if sys .platform == 'win32' :
4245 exc_name = 'python.exe'
43-
46+ platform = 'Win64'
47+ # Check the python bundled with unreal first
48+ py_exe = sys_exe .parent .parent / f'ThirdParty/Python3/{ platform } /{ exc_name } '
49+ if py_exe .exists ():
50+ return str (py_exe )
51+ # Fallback to guessing based on sys.prefix
4452 real_prefix = os .path .realpath (sys .prefix )
45- return os .path .join (real_prefix , exc_name )
53+ py_exe = Path (real_prefix ) / exc_name
54+ if py_exe .exists ():
55+ return str (py_exe )
56+ raise FileNotFoundError (f'Cannot find python executable for pip install. '
57+ f'Checked { py_exe } and { real_prefix } / { exc_name } ' )
4658
4759@fail_safe
4860def install_nxt_to_interpreter ():
You can’t perform that action at this time.
0 commit comments