不支持安装MatLab引擎从PYTHON-PYTHON 3.7调用MATL AB函数,导致导入失败

ni65a41a  于 2022-11-15  发布在  Matlab
关注(0)|答案(1)|浏览(409)

我做了我找到的每个导游都会做的事情。我在我的Anaconda环境中,并且我已经转到setup.py所在的目录。我安装了它,然后启动了Python,然后尝试导入它,它显示3.7不受支持,尽管它在受支持的列表中,而我正在运行3.7:

(opt) vogtster@Vogtsters-Mini python % python setup.py build --build-base=$(mktemp -d) install --user
/Users/vogtster/opt/anaconda3/envs/opt/lib/python3.7/site-packages/setuptools/dist.py:534: UserWarning: The version specified ('R2022a') is an invalid version, this may not work as expected with newer versions of setuptools, pip, and PyPI. Please see PEP 440 for more details.
  "details." % version
running build
running build_py
creating /var/folders/2t/1hqm8qtd78xb9grhqz2023_w0000gn/T/tmp.CcDlA6kb/lib
creating /var/folders/2t/1hqm8qtd78xb9grhqz2023_w0000gn/T/tmp.CcDlA6kb/lib/matlab
copying dist/matlab/__init__.py -> /var/folders/2t/1hqm8qtd78xb9grhqz2023_w0000gn/T/tmp.CcDlA6kb/lib/matlab
creating /var/folders/2t/1hqm8qtd78xb9grhqz2023_w0000gn/T/tmp.CcDlA6kb/lib/matlab/engine
copying dist/matlab/engine/fevalfuture.py -> /var/folders/2t/1hqm8qtd78xb9grhqz2023_w0000gn/T/tmp.CcDlA6kb/lib/matlab/engine
copying dist/matlab/engine/matlabengine.py -> /var/folders/2t/1hqm8qtd78xb9grhqz2023_w0000gn/T/tmp.CcDlA6kb/lib/matlab/engine
copying dist/matlab/engine/basefuture.py -> /var/folders/2t/1hqm8qtd78xb9grhqz2023_w0000gn/T/tmp.CcDlA6kb/lib/matlab/engine
copying dist/matlab/engine/__init__.py -> /var/folders/2t/1hqm8qtd78xb9grhqz2023_w0000gn/T/tmp.CcDlA6kb/lib/matlab/engine
copying dist/matlab/engine/matlabfuture.py -> /var/folders/2t/1hqm8qtd78xb9grhqz2023_w0000gn/T/tmp.CcDlA6kb/lib/matlab/engine
copying dist/matlab/engine/futureresult.py -> /var/folders/2t/1hqm8qtd78xb9grhqz2023_w0000gn/T/tmp.CcDlA6kb/lib/matlab/engine
copying dist/matlab/engine/enginehelper.py -> /var/folders/2t/1hqm8qtd78xb9grhqz2023_w0000gn/T/tmp.CcDlA6kb/lib/matlab/engine
copying dist/matlab/engine/engineerror.py -> /var/folders/2t/1hqm8qtd78xb9grhqz2023_w0000gn/T/tmp.CcDlA6kb/lib/matlab/engine
copying dist/matlab/engine/enginesession.py -> /var/folders/2t/1hqm8qtd78xb9grhqz2023_w0000gn/T/tmp.CcDlA6kb/lib/matlab/engine
running install
/Users/vogtster/opt/anaconda3/envs/opt/lib/python3.7/site-packages/setuptools/command/install.py:37: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
  setuptools.SetuptoolsDeprecationWarning,
/Users/vogtster/opt/anaconda3/envs/opt/lib/python3.7/site-packages/setuptools/command/easy_install.py:147: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
  EasyInstallDeprecationWarning,
/Users/vogtster/opt/anaconda3/envs/opt/lib/python3.7/site-packages/pkg_resources/__init__.py:125: PkgResourcesDeprecationWarning: R2022a is an invalid version and will not be supported in a future release
  PkgResourcesDeprecationWarning,
running bdist_egg
running egg_info
writing dist/matlabengineforpython.egg-info/PKG-INFO
writing dependency_links to dist/matlabengineforpython.egg-info/dependency_links.txt
writing top-level names to dist/matlabengineforpython.egg-info/top_level.txt
/Users/vogtster/opt/anaconda3/envs/opt/lib/python3.7/site-packages/setuptools/command/egg_info.py:627: SetuptoolsDeprecationWarning: Custom 'build_py' does not implement 'get_data_files_without_manifest'.
Please extend command classes from setuptools instead of distutils.
  SetuptoolsDeprecationWarning
reading manifest file 'dist/matlabengineforpython.egg-info/SOURCES.txt'
writing manifest file 'dist/matlabengineforpython.egg-info/SOURCES.txt'
installing library code to /var/folders/2t/1hqm8qtd78xb9grhqz2023_w0000gn/T/tmp.CcDlA6kb/bdist.macosx-10.9-x86_64/egg
running install_lib
creating /var/folders/2t/1hqm8qtd78xb9grhqz2023_w0000gn/T/tmp.CcDlA6kb/bdist.macosx-10.9-x86_64
creating /var/folders/2t/1hqm8qtd78xb9grhqz2023_w0000gn/T/tmp.CcDlA6kb/bdist.macosx-10.9-x86_64/egg
creating /var/folders/2t/1hqm8qtd78xb9grhqz2023_w0000gn/T/tmp.CcDlA6kb/bdist.macosx-10.9-x86_64/egg/matlab
copying /var/folders/2t/1hqm8qtd78xb9grhqz2023_w0000gn/T/tmp.CcDlA6kb/lib/matlab/__init__.py -> /var/folders/2t/1hqm8qtd78xb9grhqz2023_w0000gn/T/tmp.CcDlA6kb/bdist.macosx-10.9-x86_64/egg/matlab
creating /var/folders/2t/1hqm8qtd78xb9grhqz2023_w0000gn/T/tmp.CcDlA6kb/bdist.macosx-10.9-x86_64/egg/matlab/engine
copying /var/folders/2t/1hqm8qtd78xb9grhqz2023_w0000gn/T/tmp.CcDlA6kb/lib/matlab/engine/fevalfuture.py -> /var/folders/2t/1hqm8qtd78xb9grhqz2023_w0000gn/T/tmp.CcDlA6kb/bdist.macosx-10.9-x86_64/egg/matlab/engine
copying /var/folders/2t/1hqm8qtd78xb9grhqz2023_w0000gn/T/tmp.CcDlA6kb/lib/matlab/engine/matlabengine.py -> /var/folders/2t/1hqm8qtd78xb9grhqz2023_w0000gn/T/tmp.CcDlA6kb/bdist.macosx-10.9-x86_64/egg/matlab/engine
copying /var/folders/2t/1hqm8qtd78xb9grhqz2023_w0000gn/T/tmp.CcDlA6kb/lib/matlab/engine/basefuture.py -> /var/folders/2t/1hqm8qtd78xb9grhqz2023_w0000gn/T/tmp.CcDlA6kb/bdist.macosx-10.9-x86_64/egg/matlab/engine
copying /var/folders/2t/1hqm8qtd78xb9grhqz2023_w0000gn/T/tmp.CcDlA6kb/lib/matlab/engine/__init__.py -> /var/folders/2t/1hqm8qtd78xb9grhqz2023_w0000gn/T/tmp.CcDlA6kb/bdist.macosx-10.9-x86_64/egg/matlab/engine
copying /var/folders/2t/1hqm8qtd78xb9grhqz2023_w0000gn/T/tmp.CcDlA6kb/lib/matlab/engine/matlabfuture.py -> /var/folders/2t/1hqm8qtd78xb9grhqz2023_w0000gn/T/tmp.CcDlA6kb/bdist.macosx-10.9-x86_64/egg/matlab/engine
copying /var/folders/2t/1hqm8qtd78xb9grhqz2023_w0000gn/T/tmp.CcDlA6kb/lib/matlab/engine/_arch.txt -> /var/folders/2t/1hqm8qtd78xb9grhqz2023_w0000gn/T/tmp.CcDlA6kb/bdist.macosx-10.9-x86_64/egg/matlab/engine
copying /var/folders/2t/1hqm8qtd78xb9grhqz2023_w0000gn/T/tmp.CcDlA6kb/lib/matlab/engine/futureresult.py -> /var/folders/2t/1hqm8qtd78xb9grhqz2023_w0000gn/T/tmp.CcDlA6kb/bdist.macosx-10.9-x86_64/egg/matlab/engine
copying /var/folders/2t/1hqm8qtd78xb9grhqz2023_w0000gn/T/tmp.CcDlA6kb/lib/matlab/engine/enginehelper.py -> /var/folders/2t/1hqm8qtd78xb9grhqz2023_w0000gn/T/tmp.CcDlA6kb/bdist.macosx-10.9-x86_64/egg/matlab/engine
copying /var/folders/2t/1hqm8qtd78xb9grhqz2023_w0000gn/T/tmp.CcDlA6kb/lib/matlab/engine/engineerror.py -> /var/folders/2t/1hqm8qtd78xb9grhqz2023_w0000gn/T/tmp.CcDlA6kb/bdist.macosx-10.9-x86_64/egg/matlab/engine
copying /var/folders/2t/1hqm8qtd78xb9grhqz2023_w0000gn/T/tmp.CcDlA6kb/lib/matlab/engine/enginesession.py -> /var/folders/2t/1hqm8qtd78xb9grhqz2023_w0000gn/T/tmp.CcDlA6kb/bdist.macosx-10.9-x86_64/egg/matlab/engine
byte-compiling /var/folders/2t/1hqm8qtd78xb9grhqz2023_w0000gn/T/tmp.CcDlA6kb/bdist.macosx-10.9-x86_64/egg/matlab/__init__.py to __init__.cpython-37.pyc
byte-compiling /var/folders/2t/1hqm8qtd78xb9grhqz2023_w0000gn/T/tmp.CcDlA6kb/bdist.macosx-10.9-x86_64/egg/matlab/engine/fevalfuture.py to fevalfuture.cpython-37.pyc
byte-compiling /var/folders/2t/1hqm8qtd78xb9grhqz2023_w0000gn/T/tmp.CcDlA6kb/bdist.macosx-10.9-x86_64/egg/matlab/engine/matlabengine.py to matlabengine.cpython-37.pyc
byte-compiling /var/folders/2t/1hqm8qtd78xb9grhqz2023_w0000gn/T/tmp.CcDlA6kb/bdist.macosx-10.9-x86_64/egg/matlab/engine/basefuture.py to basefuture.cpython-37.pyc
byte-compiling /var/folders/2t/1hqm8qtd78xb9grhqz2023_w0000gn/T/tmp.CcDlA6kb/bdist.macosx-10.9-x86_64/egg/matlab/engine/__init__.py to __init__.cpython-37.pyc
byte-compiling /var/folders/2t/1hqm8qtd78xb9grhqz2023_w0000gn/T/tmp.CcDlA6kb/bdist.macosx-10.9-x86_64/egg/matlab/engine/matlabfuture.py to matlabfuture.cpython-37.pyc
byte-compiling /var/folders/2t/1hqm8qtd78xb9grhqz2023_w0000gn/T/tmp.CcDlA6kb/bdist.macosx-10.9-x86_64/egg/matlab/engine/futureresult.py to futureresult.cpython-37.pyc
byte-compiling /var/folders/2t/1hqm8qtd78xb9grhqz2023_w0000gn/T/tmp.CcDlA6kb/bdist.macosx-10.9-x86_64/egg/matlab/engine/enginehelper.py to enginehelper.cpython-37.pyc
byte-compiling /var/folders/2t/1hqm8qtd78xb9grhqz2023_w0000gn/T/tmp.CcDlA6kb/bdist.macosx-10.9-x86_64/egg/matlab/engine/engineerror.py to engineerror.cpython-37.pyc
byte-compiling /var/folders/2t/1hqm8qtd78xb9grhqz2023_w0000gn/T/tmp.CcDlA6kb/bdist.macosx-10.9-x86_64/egg/matlab/engine/enginesession.py to enginesession.cpython-37.pyc
creating /var/folders/2t/1hqm8qtd78xb9grhqz2023_w0000gn/T/tmp.CcDlA6kb/bdist.macosx-10.9-x86_64/egg/EGG-INFO
copying dist/matlabengineforpython.egg-info/PKG-INFO -> /var/folders/2t/1hqm8qtd78xb9grhqz2023_w0000gn/T/tmp.CcDlA6kb/bdist.macosx-10.9-x86_64/egg/EGG-INFO
copying dist/matlabengineforpython.egg-info/SOURCES.txt -> /var/folders/2t/1hqm8qtd78xb9grhqz2023_w0000gn/T/tmp.CcDlA6kb/bdist.macosx-10.9-x86_64/egg/EGG-INFO
copying dist/matlabengineforpython.egg-info/dependency_links.txt -> /var/folders/2t/1hqm8qtd78xb9grhqz2023_w0000gn/T/tmp.CcDlA6kb/bdist.macosx-10.9-x86_64/egg/EGG-INFO
copying dist/matlabengineforpython.egg-info/top_level.txt -> /var/folders/2t/1hqm8qtd78xb9grhqz2023_w0000gn/T/tmp.CcDlA6kb/bdist.macosx-10.9-x86_64/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents...
matlab.__pycache__.__init__.cpython-37: module references __file__
matlab.__pycache__.__init__.cpython-37: module references __path__
matlab.engine.__pycache__.__init__.cpython-37: module references __file__
creating 'dist/matlabengineforpython-R2022a-py3.7.egg' and adding '/var/folders/2t/1hqm8qtd78xb9grhqz2023_w0000gn/T/tmp.CcDlA6kb/bdist.macosx-10.9-x86_64/egg' to it
removing '/var/folders/2t/1hqm8qtd78xb9grhqz2023_w0000gn/T/tmp.CcDlA6kb/bdist.macosx-10.9-x86_64/egg' (and everything under it)
Processing matlabengineforpython-R2022a-py3.7.egg
removing '/Users/vogtster/.local/lib/python3.7/site-packages/matlabengineforpython-R2022a-py3.7.egg' (and everything under it)
creating /Users/vogtster/.local/lib/python3.7/site-packages/matlabengineforpython-R2022a-py3.7.egg
Extracting matlabengineforpython-R2022a-py3.7.egg to /Users/vogtster/.local/lib/python3.7/site-packages
matlabengineforpython R2022a is already the active version in easy-install.pth

Installed /Users/vogtster/.local/lib/python3.7/site-packages/matlabengineforpython-R2022a-py3.7.egg
Processing dependencies for matlabengineforpython===R2022a
Finished processing dependencies for matlabengineforpython===R2022a
(opt) vogtster@Vogtsters-Mini python % python
Python 3.7.13 (default, Mar 28 2022, 07:24:34) 
[Clang 12.0.0 ] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import matlab.engine
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/vogtster/.local/lib/python3.7/site-packages/matlabengineforpython-R2022a-py3.7.egg/matlab/__init__.py", line 200, in <module>
    success = get_dirs_from_arch_file_without_import()
  File "/Users/vogtster/.local/lib/python3.7/site-packages/matlabengineforpython-R2022a-py3.7.egg/matlab/__init__.py", line 159, in get_dirs_from_arch_file_without_import
    _PYTHONVERSION = get_python_version()
  File "/Users/vogtster/.local/lib/python3.7/site-packages/matlabengineforpython-R2022a-py3.7.egg/matlab/__init__.py", line 150, in get_python_version
    raise EnvironmentError("Python %s is not supported." % _version)
OSError: Python 3_7 is not supported.
>>>

这就是我在调用python setup.py安装时所在的目录--这是不是有什么问题?

/Users/vogtster/Desktop/MATLAB_R2022a.app/extern/engines/python
7cwmlq89

7cwmlq891#

File "/Users/vogtster/.local/lib/python3.7/site-packages/matlabengineforpython-R2022a-py3.7.egg/matlab/__init__.py", line 150, in get_python_version

出于某种原因,它将目光投向了当地。我删除了这个,降级到R2021a,但并不是所有的东西都运行得很好。

相关问题