0

I have two versions of Python 3.6.1 and 3.6.2

I have a sample script below:

#! python3
import arcpy
print ("Gurminder")

The code runs by default with 3.6.1 as I have specified it to run with python3

However is there any way that I can force the compiler to run the with python 3.6.2?

Is there any parameter where I can specify the subversion of the python interpreter to be used?

I am aware of running the python with its interpreter executables for example:

"C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\python.exe" D:\inetpud_backup_17_04_2018\Gurminder\Cases\02104091\test.py'

The command works fine in command prompt however when it is run using os or subprocess module I get the error for the white space between the Program Files

Hence on researching the issue, I found the workaround on specifying the version in the header. Is there any way to define the subversion as well?

1
  • 1
    Let Python do the path escape for you, e.g. subprocess.call(["C:\\Program Files\\ArcGIS\\Pro\bin\\Python\\envs\\arcgispro-py3\\python.exe", "D:\\inetpud_backup_17_04_2018\\Gurminder\\Cases\\02104091\\test.py"]) if you want to use a specific python.exe. Commented Apr 25, 2018 at 17:13

1 Answer 1

1

You could use a direct path to Python 3.6.2 as your shebang line:

#!C:/Program Files/ArcGIS/Pro/bin/Python/envs/arcgispro-py3/python.exe"

I also see no reason why this is necessary. Python 3.6.1 and Python 3.6.2 are exactly the same except for the fixes.

There are no packages you cannot use in Python 3.6.1 and 3.6.2. Why not just use 3.6.2 instead?

Sign up to request clarification or add additional context in comments.

2 Comments

Python 3.6.2 contains the arcpy library that is inbuilt installed when we install ArcGIS Pro. I will test the same and update you about my findings.
@GurminderBharani Super. I forgot to mention, this is used to distinguish between multiple versions when running scripts, so this works for any version of Python.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.