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

相关推荐
投图匠9 小时前
十种不同风格的 CTP接口 框架
开发语言·python
2601_9679801111 小时前
深入理解词向量算法及其在Python中的实践
python·word2vec·glove·fasttext·词向量
129Lab11 小时前
电池循环测试数据自动化分析:用Python+AI工具构建一键式寿命评估流水线
python·数据分析·电池测试·数据自动化·寿命评估
treasure14011 小时前
【复古】浅尝Django前后端不分离
前端·css·python·django·bootstrap·html·web
Dmz丶12 小时前
前端转 AI 100 天 Day 44:前端集成实战——用 React 给 Agent 做个正式界面
python
jay神12 小时前
基于 YOLOv8 的手势识别系统(Web 版)
前端·人工智能·python·深度学习·yolo·计算机视觉·计算机毕业设计
DeepVisionary12 小时前
阿里云上线旗舰多模态新模型,不公布跑分且限时14天退役
python·自动化
东莞市云毅网络有限公司12 小时前
FAQ 覆盖度打分:TF-IDF 与向量嵌入双路召回的 Python 实现
python·数据清洗·rag·企业知识库·文档解析
爱笑的k1113 小时前
nano-vllm 源码剖析:千行 Python 手写离线推理引擎的调度、显存与并行时序
开发语言·python·vllm
用户83562907805113 小时前
使用 Python 控制 Excel 工作表的分页位置
后端·python