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

相关推荐
程序员三藏21 分钟前
Selenium无法定位元素的几种解决方案
自动化测试·软件测试·python·selenium·测试工具·职场和发展·测试用例
前端小趴菜~时倾22 分钟前
自我提升-python爬虫学习:day04
爬虫·python·学习
小罗和阿泽23 分钟前
接口测试系列 接口自动化测试 pytest框架(三)
开发语言·python·pytest
猿界零零七8 小时前
pip install mxnet 报错解决方案
python·pip·mxnet
不只会拍照的程序猿10 小时前
《嵌入式AI筑基笔记02:Python数据类型01,从C的“硬核”到Python的“包容”》
人工智能·笔记·python
Jay_Franklin10 小时前
Quarto与Python集成使用
开发语言·python·markdown
Oueii11 小时前
Django全栈开发入门:构建一个博客系统
jvm·数据库·python
2401_8318249611 小时前
使用Fabric自动化你的部署流程
jvm·数据库·python
njidf12 小时前
Python日志记录(Logging)最佳实践
jvm·数据库·python
@我漫长的孤独流浪12 小时前
Python编程核心知识点速览
开发语言·数据库·python