Matlab pyversion command can not find library for python3.4

前端 未结 3 1810
梦如初夏
梦如初夏 2021-01-14 00:14

I want call python3.4 from the matlab. The default version is python2.7, when I run pyversion in matlab, it shows :

   version: \'2.7\'
executable: \'/usr/bi         


        
相关标签:
3条回答
  • 2021-01-14 00:46

    I ran into a similar issue (R2015b, Ubuntu) and did not solve it with the accepted answer. I had to execute

    python3 MATLABROOT/toolbox/matlab/external/interfaces/python/+python/+internal/pyinfo.py
    

    without modifying it from the command line to make it work.

    0 讨论(0)
  • 2021-01-14 00:51

    Just so happened to have the same issue within 5 days of this post.

    Apparently matlab uses the following script to search for the library:

    MATLABROOT/toolbox/matlab/external/interfaces/python/+python/+internal/pyinfo.py

    where MATLABROOT is something you chose when you installed matlab.

    Theoretically, you could edit pyinfo.py to include '/usr/lib/x86_64-linux-gnu' in its search. For example, by appending one more method to the search locations that just returns '/usr/lib/x86_64-linux-gnu'. But I don't know what the licensing/legal/warranty ramifications of this would be, so use at your own discretion.

    0 讨论(0)
  • 2021-01-14 00:59

    Run python:

    >>> import sys
    >>> print(sys.executable)
    

    Copy the answer and use it in Matlab as follow:

    >> pyversion('C:\Users\84757\AppData\Local\Programs\Python\Python38\python.exe');
    
    0 讨论(0)
提交回复
热议问题