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

相关推荐
奔跑吧邓邓子1 分钟前
【Python爬虫(64)】从“听”开始:Python音频爬虫与语音数据处理全解析
开发语言·爬虫·python·音频·语音识别
deephub1 小时前
用PyTorch从零构建 DeepSeek R1:模型架构和分步训练详解
人工智能·pytorch·python·深度学习·deepseek
xiao智1 小时前
Ansible 数百台批量操作前期准备工作
linux·python·ansible
浪子西科2 小时前
【数据结构】(Python)第六章:图
开发语言·数据结构·python
起个破名想半天了2 小时前
Web自动化之Selenium添加网站Cookies实现免登录
python·selenium·cookie
程序趣谈2 小时前
算法随笔_57 : 游戏中弱角色的数量
数据结构·python·算法
数学人学c语言3 小时前
记录torch运行的bug
python·深度学习·bug
小爬虫程序猿3 小时前
使用Python爬虫获取淘宝商品详情:API返回值说明与案例指南
开发语言·爬虫·python
ONE_PUNCH_Ge3 小时前
Python selenium 库
python
m0_748240024 小时前
Python大数据可视化:基于大数据技术的共享单车数据分析与辅助管理系统_flask+hadoop+spider
大数据·python·信息可视化