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

相关推荐
珺毅同学8 小时前
YOLO生成预测json标签迁移问题
python·yolo·json
骑士雄师8 小时前
18.4 长期记忆可修改版
python
~小先生~8 小时前
Python从入门到放弃(一)
开发语言·python
天佑木枫8 小时前
第2天:变量与数据类型 —— 让程序记住信息
python
Dust-Chasing9 小时前
Claude Code源码剖析 - Claude Code 上下文压缩机制
人工智能·python·ai
Cloud_Shy61810 小时前
解读《Effective Python 3rd Edition》:从练气到老魔(第五章 Item 33 - 35)
开发语言·人工智能·笔记·python·学习方法
abcy07121311 小时前
python pandas csv异步后台清洗前端优先返回成功信息
前端·python·pandas
颜酱11 小时前
LangChain使用RAG 入门:让大模型读懂你的私有文档
python·langchain
天天进步201512 小时前
Python全栈项目--校园智能宿舍管理系统
开发语言·python
测试员周周12 小时前
【AI测试智能体-面试】AI测试面试60题(附回答思路)
人工智能·python·功能测试·测试工具·单元测试·自动化·测试用例