diff --git a/deploy/runtime/python/install_python.ps1 b/deploy/runtime/python/install_python.ps1 index 680103e015..21fcabc3bb 100644 --- a/deploy/runtime/python/install_python.ps1 +++ b/deploy/runtime/python/install_python.ps1 @@ -85,9 +85,10 @@ function Get-Pip { Remove-Item $filename } if (!(Test-Path $filename)) { - Invoke-WebRequestExitOnError https://bootstrap.pypa.io/${filename} $filename +#Specific to Python 3.7 and LandBOSSE 2.3.0.3 + Invoke-WebRequestExitOnError https://bootstrap.pypa.io/pip/3.7/${filename} $filename } - Invoke-CommandExitOnError ".\python.exe $filename --prefix=$path --no-warn-script-location" + Invoke-CommandExitOnError ".\python.exe $filename --prefix=`"$path`" --no-warn-script-location" if ($FORCE_DOWNLOAD -eq 1) { Remove-Item $filename } @@ -164,7 +165,7 @@ if (!(Test-Path $PYTHON_CONFIG_FILE)) { $pythonPath = Get-Python $version $majorMinor $execPath = Join-Path $pythonPath python.exe -$pipPath = Join-Path $pythonPath Scripts | Join-Path -ChildPath pip.exe +$pipPath = Join-Path $pythonPath Scripts | Join-Path -ChildPath pip3.exe # Update the python config file. $data = Get-Content -Raw -Path $PYTHON_CONFIG_FILE | ConvertFrom-Json diff --git a/deploy/runtime/python/install_python.sh b/deploy/runtime/python/install_python.sh index 0c8d5cba7e..3ea48da892 100755 --- a/deploy/runtime/python/install_python.sh +++ b/deploy/runtime/python/install_python.sh @@ -87,7 +87,7 @@ if [ -z $FORCE_DOWNLOAD ]; then FORCE_DOWNLOAD=1 fi -if [ -z $3 ]; then +if [ -z "$3" ]; then show_help exit 1 fi @@ -102,12 +102,12 @@ fi PYTHON_MAJOR_MINOR="${VER_ARRAY[0]}${VER_ARRAY[1]}" INSTALL_BASE=$3 -if [ ! -d $INSTALL_BASE ]; then +if [ ! -d "$INSTALL_BASE" ]; then error "path $INSTALL_BASE does not exist" exit 1 fi -cd $INSTALL_BASE +cd "$INSTALL_BASE" CONFIG_FILE=python_config.json if [ ! -f $CONFIG_FILE ]; then @@ -115,16 +115,20 @@ if [ ! -f $CONFIG_FILE ]; then exit 1 fi +arch=$(uname -m) if [[ "$OSTYPE" == "linux-gnu" ]]; then PLATFORM=Linux-x86_64 elif [[ "$OSTYPE" == "darwin"* ]]; then - PLATFORM=MacOSX-x86_64 + PLATFORM=MacOSX-$arch else error "unknown OS type $OSTYPE" exit 1 fi + + + CONDA_PACKAGE_NAME=Miniconda3-py${PYTHON_MAJOR_MINOR}_${CONDA_VERSION}-${PLATFORM}.sh CONDA_URL=https://repo.anaconda.com/miniconda/$CONDA_PACKAGE_NAME CONDA_PACKAGE_PATH=/tmp/$CONDA_PACKAGE_NAME diff --git a/src/pythonhandler.cpp b/src/pythonhandler.cpp index 5ccca83332..a5c6cd4b0a 100644 --- a/src/pythonhandler.cpp +++ b/src/pythonhandler.cpp @@ -151,7 +151,8 @@ bool CheckPythonInstalled(const PythonConfig& config){ } bool InstallPythonWindows(const std::string& path, const PythonConfig& config){ - std::string cmd = "powershell.exe -windowstyle hidden -ExecutionPolicy Bypass -File " + path + "/install_python.ps1 -version " + config.pythonVersion + " -config " + path; +// std::string cmd = "powershell.exe -windowstyle hidden -ExecutionPolicy Bypass -File " + path + "/install_python.ps1 -version " + config.pythonVersion + " -config " + path; + std::string cmd = "powershell.exe -windowstyle hidden -ExecutionPolicy Bypass -File \"" + path + "/install_python.ps1\" -version " + config.pythonVersion + " -config \"" + path + "\""; int rvalue = system(cmd.c_str()); return (bool)rvalue; }