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

相关推荐
Danceful_YJ11 分钟前
4.权重衰减(weight decay)
python·深度学习·机器学习
Zonda要好好学习1 小时前
Python入门Day5
python
电商数据girl2 小时前
有哪些常用的自动化工具可以帮助处理电商API接口返回的异常数据?【知识分享】
大数据·分布式·爬虫·python·系统架构
CoooLuckly2 小时前
numpy数据分析知识总结
python·numpy
超龄超能程序猿2 小时前
(六)PS识别:源数据分析- 挖掘图像的 “元语言”技术实现
python·组合模式
amazinging3 小时前
北京-4年功能测试2年空窗-报培训班学测开-第四十四天
python·学习·appium
UrbanJazzerati3 小时前
Xlwings安装报错:Connection timed out & WinError 32?一招解决你的安装难题!
python
Tipriest_3 小时前
Python异常类型介绍
开发语言·python·异常
前端付豪3 小时前
21、用 Python + Pillow 实现「朋友圈海报图生成器」📸(图文合成 + 多模板 + 自动换行)
后端·python
猿榜4 小时前
魔改编译-永久解决selenium痕迹(二)
javascript·python