3

I am just started looking/experimenting pyscript as per the current python code which is running on Python 3.6.0. But looks like pyscript loads the python version along with Pyodide and it is retuning the latest stable version based on the Pyodide version.

Problem Statement : Is there any way we can change/switch the python version as per the need while working with pyscript ?

What did I tried so far to verify the Pyodide and Python version :

I checked the version of Pyodide by using below code.

<link rel="stylesheet" href="https://pyscript.net/latest/pyscript.css"/>
<script defer src="https://pyscript.net/latest/pyscript.js"></script>

<py-script>import pyodide_js; print(pyodide_js.version)</py-script>

As per the above code snippet, It is returning 0.21.2, Now to check python version.

<link rel="stylesheet" href="https://pyscript.net/latest/pyscript.css"/>
<script defer src="https://pyscript.net/latest/pyscript.js"></script>

<py-script>
    import pyodide_js;
    import sys;
    
    print('Pyodide version : ' + pyodide_js.version)
    print('Python version : ' + sys.version)
</py-script>

It is returning 3.10.2 but I want to change/switch it to 3.6.0.

Debug Diva
  • 26,058
  • 13
  • 70
  • 123

1 Answers1

2

YOu cannot as Python is built into Pyodide. You would need to rebuild Pyodide to change the version of Python. I also do not think that Python 3.6 will work with the current version of PyScript and Pyodide. Your only practical option is to make your application work with the Pyodide version of Python.

John Hanley
  • 74,467
  • 6
  • 95
  • 159
  • What will happen if application is too big and not in a good condition to change it as per the latest version of python ? There is no way to achieve this ? – Debug Diva Nov 22 '22 at 12:19
  • @RohìtJíndal 1) To rebuild Pyodide and change Python versions is a big task. 2) Running Python in the web browser has many requirements and restrictions. If your code is not in good condition, you will not get it to run in a browser without a lot of work. 3) Since I have not seen your code, I don't know. Given enough time and resources, anything is possible. – John Hanley Nov 22 '22 at 16:52