필터 지우기
필터 지우기

Matlab 2019a pyenv.Library empty when using Python 2.7

조회 수: 1 (최근 30일)
Simon Geoffroy-Gagnon
Simon Geoffroy-Gagnon 2020년 10월 9일
댓글: Simon Geoffroy-Gagnon 2023년 3월 27일
I am using Ubuntu 20.04, with bothh Python 2.7 and Python 3.8 installed. When I try to load Python 2.7 in matlab, by doing pyenv('Version','python2.7'), I get:
pyenv('Version','python2.7')
ans =
PythonEnvironment with properties:
Version: "2.7"
Executable: "/usr/bin/python2.7"
Library: ""
Home: "/usr"
Status: NotLoaded
ExecutionMode: OutOfProcess
And calling any py function will not work, as it does not find the library.
pyenv works with Python 3.8:
pyenv('Version','python3.8')
ans =
PythonEnvironment with properties:
Version: "3.8"
Executable: "/usr/bin/python3.8"
Library: "libpython3.8.so.1.0"
Home: "/usr"
Status: NotLoaded
ExecutionMode: OutOfProcess.
I require Python 2.7. Any hep would be appreciated.
  댓글 수: 2
Sven
Sven 2023년 3월 27일
편집: Sven 2023년 3월 27일
did you manage to solve this?
I am having the exact reverse problem, able to run python2.7 and not being able to run python3.8. For me the library remains empty in python3.8 and shows libpython2.7.so.1.0 in v2.7
edit: solved using sudo apt-get install python3.8-dev
Simon Geoffroy-Gagnon
Simon Geoffroy-Gagnon 2023년 3월 27일
Interesting. I ended up just going through Python first and using the Matlab library in python and it worked for my purposes. I have not tried using the python 2.7-dev though, but that would likely work! Thank you.

댓글을 달려면 로그인하십시오.

채택된 답변

Sven
Sven 2023년 3월 27일
I managed to solve my problem using sudo apt-get install python3.8-dev. Maybe you can solve the 2.7 case in the same manner using:
sudo apt-get install python2.7-dev

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by