在matlab中导入numpy

2024-04-25 18:58:56 发布

您现在位置:Python中文网/ 问答频道 /正文

我在matlab中使用python,我正在尝试导入numpy,但我不能

首先,我在康达创建了一个环境:

conda create -n matlab python=3.7 numpy

然后在matlab提示符下设置:

pyversion('C:\Users\Familia\.conda\envs\matlab\python.exe')
>> pyenv

ans = 

  PythonEnvironment with properties:

          Version: "3.7"
       Executable: "C:\Users\Familia\.conda\envs\matlab\python.exe"
          Library: "C:\Users\Familia\.conda\envs\matlab\python37.dll"
             Home: "C:\Users\Familia\.conda\envs\matlab"
           Status: NotLoaded
    ExecutionMode: InProcess

然后,当我试着看我是否有numpy时,我得到了以下结果:

>> help('numpy')

numpy not found.

Use the Help browser search field to search the documentation, or type "help help" for help command options, such as help for methods.

如果我尝试

py.importlib.import_module('numpy')

我明白了:

enter image description here

我错过了什么?


Tags: thenumpyforsearch环境createhelpexe