Python 安装 matlabengin 时遇到报错:setup.py install is deprecated. !! 以及 Cannot update time stamp of directory 'dist\matlabengine.egg-info' 的解决方案
Python 安装 matlabengin 时遇到报错:setup.py install is deprecated. !! 以及 Cannot update time stamp of directory 'dist\matlabengine.egg-info' 的解决方案
大概是去年的时候 MATLAB 出了新皮肤。最近为了用 MATLAB 的新皮肤,从 MATLAB R2022b 切换到了 R2024a,这样一来 matlabengin 就需要重新安装了。原本想在同学面前炫一手 Visual Stdio Code 的技,没想到一连吃了两个报错。这里写个博客,一口气把两个问题全给解决了。
以下是我的环境配置:
- 平台:Windows 10 22H2
- Python 版本:3.9.10
- MATLAB 安装路径:
D:\Program Files\MATLAB\R2024a
首先按照安装 MATLAB engin 的一般步骤,进入到 MATLAB 安装目录下的 extern\engines\python,进入终端执行:
python -u ./setup.py install
发现出现报错(中间省略一长串不必要的信息,展示最关键的部分):
D:\Python\Python39\Lib\site-packages\setuptools\_distutils\cmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated.
!!
********************************************************************************
Please avoid running ``setup.py`` directly.
Instead, use pypa/build, pypa/installer or other
standards-based tools.
See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.
********************************************************************************
...
[05/30/24 23:27:50] ERROR listing git files failed - pretending git.py:24
there aren't any
zip_safe flag not set; analyzing archive contents...
matlab.__pycache__.__init__.cpython-39: module references __file__
matlab.__pycache__.__init__.cpython-39: module references __path__
matlab.engine.__pycache__.__init__.cpython-39: module references __file__
这里一连有好几个工具包都给出了相类似的提示信息,就是希望我不要运行 ./setup.py。具体的解释可以参见给出的博客文章,原文是长篇大论的论述:Why you shouldn't invoke setup.py directly。简言之就是通过 Python 直接调用 setup.py 安装 Python 工具包的形式已经被淘汰了。这里安装工具包最简单的方法是:
pip install .
直接用一个点代指当前目录下的工具包。
之后遇到了这个报错:
Looking in indexes: https://mirrors.aliyun.com/pypi/simple/
Processing d:\program files\matlab\r2024a\extern\engines\python
Installing build dependencies ... done
Getting requirements to build wheel ... error
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> [1 lines of output]
error: Cannot update time stamp of directory 'dist\matlabengine.egg-info'
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
[notice] A new release of pip is available: 23.2.1 -> 24.0
[notice] To update, run: python.exe -m pip install --upgrade pip
哎你就说巧不巧吧,昨天我刚刚入门安装使用 R 语言就遇到了类似的问题,所以果断判断出了问题。究其原因,是因为 D:\Program Files 这个路径虽然不在系统盘(C盘)内,但仍然被 Windows 视作程序安装目录 C:\Program Files\ 的一个延伸,属于系统目录的一部分,因此是需要管理员权限的。而且,程序和程序之间相互的目录访问都需要管理员权限。由于直接启动 pip 没有管理员权限,无法将时间戳写入 D:\Program Files\MATLAB\R2024a\extern\engines\python\dist\matlabengine.egg-info。敬请参照我的博客文章 R 语言入门学习笔记:软件安装踩坑记录——删除所有包以及彻底解决库包被安装到 C 盘用户目录下的问题,以及一些其他需要注意的点。所以解决的方案就是:
- 在 Windows 菜单下重新找到系统终端
- 以管理员身份运行
- 从新
cd到 MATLAB 安装目录下的extern\engines\python文件夹内执行pip install .
好在我安装了 MSYS2 zsh 和 gsudo,所以可以直接 sudo pip install .,问题完美解决。
Looking in indexes: https://mirrors.aliyun.com/pypi/simple/
Processing d:\program files\matlab\r2024a\extern\engines\python
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: matlabengine
Building wheel for matlabengine (pyproject.toml) ... done
...
Successfully built matlabengine
Installing collected packages: matlabengine
Attempting uninstall: matlabengine
Found existing installation: matlabengine 24.1
Uninstalling matlabengine-24.1:
Successfully uninstalled matlabengine-24.1
Successfully installed matlabengine-24.1
当然了,根治这种情况的办法当然是卸载重装。重装 R 尚且还算容易,MATLAB 这个安装体量跟双开门冰箱似的,我只能说大可不必。以后还是当心点吧,对于 Windows 上经常需要在终端下调用的编程语言解释器之类的东西不要装进任何一个盘根目录下的 Program Files 文件夹下面——即使 Windows 鼓励用户这么做,还是应该在此盘根目录下新建一个文件夹。只能说 Windows 的文件系统相对来说比较混乱,Linux 下就完全不会出现这种问题。
Python 安装 matlabengin 时遇到报错:setup.py install is deprecated. !! 以及 Cannot update time stamp of directory 'dist\matlabengine.egg-info' 的解决方案的更多相关文章
- Python安装pip时, 报错:zipimport.ZipImportError: can't decompress data; zlib not available
解决办法: 1.安装依赖zlib.zlib-devel 2.重新编译安装Python 具体步骤: 1 到python安装目录下,运行./configure 2 编辑Modules/Setup文件 vi ...
- 安装vue-cli时-4058报错的解决方法
一.报错信息 安装vue-cli时-4058报错 二.解决办法 1.安装淘宝镜像 npm --registry https://registry.npm.taobao.org info undersc ...
- Python 安装MySQLdb模块遇到报错及解决方案:_mysql.c(42) : fatal error C1083: Cannot open include file: 'config-win.h': No such file or directory
一.问题 系统:win7 64位 在下载MySQL-python-1.2.5.zip,使用python setup.py install 安装时,出现以下报错: _mysql.c(42) : fata ...
- python安装模块的时候报错error: command 'gcc' failed with exit status 1
[情况] 在写Python代码的时候,需要用到psutil模块,需要安装. 但是在安装时,报错:error: command 'gcc' failed with exit status 1 [解决步骤 ...
- 按照教程自动安装RFNoC时.在使用pip安装pybombs时出现报错,解决办法
$ sudo apt-get install git $ sudo apt-get install python-setuptools python-dev python-pip build-esse ...
- 解决小米手机USB安装apk时AS报错:INSTALL_FAILED_USER_RESTRICTED
今天,直接用AS在小米手机上运行安装的时候总是报错:INSTALL_FAILED_USER_RESTRICTED,于是乎,通过以下方式解决: 在开发者选项将USB安装打开,然后,哈,解决了.记录一下.
- pip安装psutil模块时候报错:yum install python-devel mysql-devel zlib-devel openssl-devel
yum install python-devel mysql-devel zlib-devel openssl-devel [root@localhost software]# pip install ...
- Python安装第三方库,报错超时: Read timed out.
1.安装beautifulsoup4 >pip install beautifulsoup4 报错超时: Read timed out. 2.解决办法:pip --default-timeout ...
- 安装nginx环境(含lua)时遇到报错ngx_http_lua_common.h:20:20: error: luajit.h: No such file or directory的解决
下面是安装nginx+lua环境时使用的相关模块及版本,ngx_devel_kit和lua-nginx-module模块用的都是github上最新的模块.并进行了LuaJIT的安装. #Install ...
- pip安装selenium时,报错“You are using pip version 10.0.1, however version 18.0 is available.”的问题
pip安装selenium,pip install selenium 类型这样错误 1 原因可能不是以管理员身份运行cmd安装selenium 2 解决方式 也是要管理员身份运行 重点在最后一句 ...
随机推荐
- [Caddy2] URL访问路径的重定向和重写规则 (redir/rewrite 指令)
当我们在规划网站路径时,为了保留搜索引擎收录 避免404的同时做到升级,常用到重定向跳转和URL重写. 重定向(redirect) 在 Caddy 中为 redir 指令. https://caddy ...
- vue中vant-list组件实现下拉刷新,上滑加载
后端返回的数据是一股脑的情况(不是按pageSize,pageNum一组一组的发送)时,前端使用vant-list实现懒加载需要再写一点js,记录一下 main.js: Vue.use(List); ...
- SpringBoot使用JSch操作Linux
推荐使用Hutool的Jsch工具包(它用的连接池的技术) 一.SSH远程连接服务器 SSH更多见:http://t.csdnimg.cn/PrsNv 推荐连接工具:FinalShell.Xshell ...
- 我的 Kafka 旅程 - 概念 · 特点 · 组成 · 模式 · 应用
系列目录 我的 Kafka 旅程 - 概念 · 特点 · 组成 · 模式 · 应用 我的 Kafka 旅程 - Linux下的安装 · 基础命令 · 集群 我的 Kafka 旅程 - Producer ...
- HTTP 结构概述
Web 客户端和服务器 Web 内容都是存储在 Web 服务器上的,Web 服务器所使用的是 HTTP 协议,因此经常被称为 HTTP 服务器,HTTP 服务器存储了因特网的数据.客户端向服务器发送 ...
- SpringBoot-RSA加密
前言 最近由于工作业务的需要,需要对指定的字段信息进行非对称加解密:由于需要加密的内容过于庞大:自己执行程序会出现:Data must not be longer than 117 bytes 的异常 ...
- 使用c#强大的表达式树实现对象的深克隆
一.表达式树的基本概念 表达式树是一个以树状结构表示的表达式,其中每个节点都代表表达式的一部分.例如,一个算术表达式 a + b 可以被表示为一个树,其中根节点是加法运算符,它的两个子节点分别是 a ...
- 智能控制 | AIRIOT智慧楼宇管理解决方案
许多行业客户在智慧楼宇的建设中主要面临运营管理低效,楼宇内部各个系统相互独立,不仅管理操作复杂,而且各系统间的数据无法分享,无法支撑大数据分析.此外,由于楼宇管理系统的低效,50%的建筑能耗是被浪费的 ...
- 【漏洞复现】蓝凌OA sysUiComponent 任意文件上传漏洞
阅读须知 此文所提供的信息只为网络安全人员对自己所负责的网站.服务器等(包括但不限于)进行检测或维护参考,未经授权请勿利用文章中的技术资料对任何计算机系统进行入侵操作.利用此文所提供的信息而造成的直接 ...
- 保姆教程系列:Git 实用命令详解
!!!是的没错,胖友们,保姆教程系列又更新了!!! @ 目录 前言 1.将本地项目推送到远程仓库 2. Idea Git回退到某个历史版本 3. 修改项目关联远程地址方法 4. Git 修改分支的名称 ...