Python中文
首页
教程
问答
标签
搜索
登录
注册
在PEX中使用python脚本执行时出现pyyaml依赖项错误
回答此问题可获得
20
贡献值,回答如果被采纳可获得
50
分。
<p>我在尝试使用PEX打包和执行脚本时遇到以下错误</p> <pre><code>Failed to execute PEX file. Needed macosx_10_14_x86_64-cp-38-cp38 compatible dependencies for: 1: pyyaml Required by: app==0.0.1 But this pex only contains: PyYAML-5.3.1-cp39-cp39-macosx_10_14_x86_64.whl </code></pre> <p>下面是我打包文件的步骤:</p> <p>执行以下命令以生成zip文件</p> <pre><code>pex requests 'XlsxWriter==1.3.7' 'urllib3==1.26.2' 'PyYAML==5.3.1' ./app -o app.pex --python-shebang '#!/usr/bin/env python3' </code></pre> <p>使用调试日志执行时,我看到以下错误</p> <pre><code>(base)$ PEX_VERBOSE=9 ./app.pex pex: Activating PEX virtual environment from ./app.pex :: Searching dependency cache: /Users[PATH]/app.pex/pex: Activating PEX virtual environment from ./app.pex :: Searching dependency cache: /Users[PATH]/app.pex/pex: Activating PEX virtual environment from ./app.pex :: Searching dependency cache: /Users[PATH]/app.pex/pex: Activating PEX virtual environment from ./app.pex :: Searching dependency cache: /Users[PATH]/app.pex/pex: Activating PEX virtual environment from ./app.pex :: Searching dependency cache: /Users[PATH]/app.pex/pex: Activating PEX virtual environment from ./app.pex :: Searching dependency cache: /Users[PATH]/app.pex/pex: Activating PEX virtual environment from ./app.pex :: Searching dependency cache: /Users[PATH]/app.pex/pex: Activating PEX virtual environment from ./app.pex :: Resolving pyyaml from [Requirement.parse('PyYAML==5.3.1; python_full_version != "3.0.*" and python_full_version != "3.1.*" and python_full_version pex: Failed to resolve a requirement: The 'pyyaml' distribution was not found and is required by the application pex: Failed to resolve a requirement: The 'PyYAML' distribution was not found and is required by app pex: Activating PEX virtual environment from ./app.pex :: Resolving chardet from [Requirement.parse('chardet==4.0.0; python_full_version != "3.0.*" and python_full_version != "3.1.*" and python_full_versiopex: Activating PEX virtual environment from ./app.pex :: Resolving idna from [Requirement.parse('idna==2.10; python_full_version != "3.0.*" and python_full_version != "3.1.*" and python_full_version != "3pex: Activating PEX virtual environment from ./app.pex :: Resolving requests from [Requirement.parse('requests==2.25.1; python_full_version != "3.0.*" and python_full_version != "3.1.*" and python_full_verpex: Activating PEX virtual environment from ./app.pex :: Resolving urllib3 from [Requirement.parse('urllib3==1.26.2; python_full_version != "3.0.*" and python_full_version != "3.1.*" and python_full_versipex: Unresolved requirements: </code></pre> <p>环境:</p> <pre><code> $ python --version Python 2.7.16 $ python3 --version Python 3.9.1 $ python2 --version bash: python2: command not found $ pip --version bash: /usr/local/bin/pip: /usr/local/opt/python@3.8/bin/python3.8: bad interpreter: No such file or directory $ pex --version 2.1.24 $ whereis python /usr/bin/python </code></pre>
0 条评论
分类:
Python问答
请先
登录
后评论
默认排序
时间排序
1 个回答
匿名
1天前
擅长:python、mysql、java
<p>我通过将env改为3.9解决了这个问题</p> <pre><code>pex requests 'XlsxWriter==1.3.7' 'urllib3==1.26.2' 'PyYAML==5.3.1' ./app -o app.pex python-shebang '#!/usr/bin/env python3.9' </code></pre>
请先
登录
后评论
针对此问题:
更多的回答
关注
89
关注
收藏
1
收藏,
216
浏览
网友 提问于 2天前
相关Python问题
如何在Excel中读取公式并将其转换为Python中的计算?
1 回答
如何在excel中读取嵌入的excel,并将嵌入文件中的信息存储在主excel文件中?
10 回答
如何在Excel中返回未知列长度的非空顶行列值?
10 回答
如何在excel中选择数据列?
3 回答
如何在Excel中通过脚本自动为一列中的所有单元格创建公共别名
3 回答
如何在excel中高效格式化范围AttributeError:“tuple”对象没有属性“fill”
2 回答
如何在excel单元格中编写python函数
8 回答
如何在excel单元格中自动执行此python代码?
9 回答
如何在excel工作表中创建具有相应值的新列
6 回答
如何在Excel工作表中复制条件为单元格颜色的python数据框?
2 回答
如何在Excel工作表中循环
10 回答
如何在excel工作表中打印嵌套词典?
1 回答
如何在excel工作表中绘制所有类的继承树?
6 回答
如何在Excel工作表中自动调整列宽?
10 回答
如何在excel工作表中追加并进一步处理
4 回答
如何在excel工作表之间进行更改?
3 回答
如何在excel或csv上获取selenium数据?
3 回答
如何在Excel或Python中将正确的值赋给正确的列
10 回答
如何在excel或python中提取单词周围的文本?
4 回答
如何在excel或python中转换来自Jira的3w 1d 4h的fromat数据?
1 回答