필터 지우기
필터 지우기

how do I let matlab use a specific python3 version?

조회 수: 4 (최근 30일)
Sven
Sven 2023년 3월 27일
답변: Sven 2023년 3월 27일
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?

채택된 답변

Sven
Sven 2023년 3월 27일
I managed to solve it by installing the -dev version of python3.8:
sudo apt-get install python3.8-dev

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Call Python from MATLAB에 대해 자세히 알아보기

태그

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by