cmd: Union[List[str], str], ^ SyntaxError: invalid syntax

跑项目在调用from easyprocess import EasyProcess

遇到报错:

powershell 复制代码
cmd: Union[List[str], str],        
   ^ SyntaxError: invalid syntax

猜测是EasyProcess版本与python版本不对应

powershell 复制代码
pip show EasyProcess

查证一下:

powershell 复制代码
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Name: EasyProcess
Version: 1.1
Summary: Easy to use Python subprocess interface.
Home-page: https://github.com/ponty/easyprocess
Author: ponty
Author-email: UNKNOWN
License: BSD
Location: /home/xxx/anaconda3/envs/xxx/lib/python2.7/site-packages
Requires:
Required-by: PyVirtualDisplay

果然如此。

接下来更换EasyProcess版本,可以从EasyProcess中下载支持所用python的EasyProcess。

然后pip show EasyProcess

相关推荐
ygy.白茶11 分钟前
线性回归入门级
人工智能·python·机器学习
刘同学Python学习日记1 小时前
Python 办公自动化实战:Excel 批量处理 + 自动发邮件
python
mit6.8241 小时前
[Vid-LLM] 功能分类体系 | 视频如何被“观看“ | LLM的主要作用
人工智能·python
青铜发条2 小时前
【python】python进阶——logging日志模块
python
无规则ai2 小时前
动手学深度学习(pytorch版):第六章节—卷积神经网络(1)从全连接层到卷积
人工智能·pytorch·python·深度学习·cnn
秋难降3 小时前
优雅的代码是什么样的?🫣
java·python·代码规范
二闹4 小时前
聊天怕被老板发现?摩斯密码来帮你
后端·python
mit6.8244 小时前
[RestGPT] OpenAPI规范(OAS)
人工智能·python
360安全应急响应中心4 小时前
Python代码保护之重置操作码映射的攻与防探究(一)
python·逆向
码界奇点5 小时前
Python内置函数全解析:30个核心函数语法、案例与最佳实践指南
linux·服务器·python