Clear Filters
Clear Filters

how do I let matlab use a specific python3 version?

4 views (last 30 days)
I am running Ubuntu 18 and Matlab R2022b. My Ubuntu does not like to have a different default python3 than python3.6 (it then gives all kind of weird errors like not being able to start a terminal). Matlab R2022b does not support python3.6. I have python3.8 installed via deadsnakes/sudo apt-get install python3.8 and it works fine in the terminal (/usr/bin/python3.8). When I set this in Matlab via pyversion('/usr/bin/python3.8') it does not work. Any hints?
when I run pyversion I get:
pyversion
version: '3.8'
executable: '/usr/bin/python3.8'
library: ''
home: '/usr'
isloaded: 0
so library remains empty.
then when I run:
py.list({'This','is a','list'})
Unable to resolve the name 'py.list'.
Running pyversion('/usr/bin/python3') obviously gives the error 'Python version 3.6 is not supported.'
Running pyversion('/usr/bin/python2.7') results in a working environment:
pyversion
version: '2.7'
executable: '/usr/bin/python2.7'
library: 'libpython2.7.so.1.0'
home: '/usr'
isloaded: 0
but I need python3 instead! Any help?

Accepted Answer

Sven
Sven on 27 Mar 2023
I managed to solve it by installing the -dev version of python3.8:
sudo apt-get install python3.8-dev

More Answers (0)

Products


Release

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!