浏览代码

force virtualenv to run using python3

/pyrception-integration
leopoldo-zugasti 4 年前
当前提交
b6407647
共有 1 个文件被更改,包括 12 次插入4 次删除
  1. 16
      com.unity.perception/Editor/Pyrception/PyrceptionInstaller.cs

16
com.unity.perception/Editor/Pyrception/PyrceptionInstaller.cs


{
int steps = 3;
//Check pip install
int ExitCode = 0;
ExitCode = ExecuteCMD("pip3");
if(ExitCode != 0)
{
UnityEngine.Debug.LogError("pip3 and python >= 3 must be installed.");
}
string path = Application.dataPath.Replace("/Assets", "");
#if UNITY_EDITOR_WIN
path = path.Replace("/", "\\");

EditorUtility.DisplayProgressBar("Setting up Pyrception", "Installing virtualenv...", 0 / steps);
int ExitCode = 0;
ExitCode = 0;
ExitCode = ExecuteCMD("pip3 install virtualenv");
if (ExitCode != 0) {
EditorUtility.ClearProgressBar();

#if UNITY_EDITOR_WIN
ExitCode = ExecuteCMD($"virtualenv \"{path}\\DataInsightsEnv\"");
ExitCode = ExecuteCMD($"virtualenv -p python3 \"{path}\\DataInsightsEnv\"");
#elif (UNITY_EDITOR_OSX || UNITY_EDITOR_LINUX)
ExitCode = ExecuteCMD($"virtualenv -p python3 \"{path}/DataInsightsEnv\"");
#endif

EditorUtility.DisplayProgressBar("Setting up Pyrception", "Installing pyrception utils...", 2.5f / steps);
#if UNITY_EDITOR_WIN
ExitCode = ExecuteCMD($"\"{path}\\DataInsightsEnv\\Scripts\\activate\" && cd \"{path}\\DataInsightsEnv\\pyrception-util\" && pip --no-cache-dir install -e . && deactivate");
ExitCode = ExecuteCMD($"\"{path}\\DataInsightsEnv\\Scripts\\activate\" && cd \"{path}\\DataInsightsEnv\\pyrception-util\" && pip3 --no-cache-dir install -e . && deactivate");
ExitCode = ExecuteCMD($"source \"{path}/DataInsightsEnv/Scripts/activate\"; cd \"{path}/DataInsightsEnv/pyrception-util\"; pip --no-cache-dir install -e .; deactivate");
ExitCode = ExecuteCMD($"source \"{path}/DataInsightsEnv/Scripts/activate\"; cd \"{path}/DataInsightsEnv/pyrception-util\"; pip3 --no-cache-dir install -e .; deactivate");
#endif
if (ExitCode != 0) {
EditorUtility.ClearProgressBar();

正在加载...
取消
保存