python - PIP 安装:无法组合 --user 和 --target
问题描述
我的目标是将包安装到我机器上的特定目录中,以便我可以将其打包以与 AWS Lambda 一起使用。
这是我尝试过的:
pip install snowflake-connector-python -t .
pip install --system --target=C:\Users\path2folder --install-option=--install-scripts=C:\Users\path2folder --upgrade snowflake-connector-python
这两个选项都返回了以下错误消息:
ERROR: Can not combine '--user' and '--target'
为了使 AWS Lambda 函数正常工作,我需要将我的依赖项安装在特定目录中,以创建一个 .zip 文件进行部署。我已经通过 Google 和 StackOverflow 进行了搜索,但还没有看到回答这个问题的线程。
更新:这在 Mac 上似乎不是问题。所描述的问题是在 Windows 10 上。
解决方案
pip install --target ./py_pkg -r requirements.txt --upgrade
在使用 Microsoft Store 版本的 Python 3.9运行时,我们遇到了同样的问题。
添加--no-user
到最后似乎解决了这个问题。也许你可以在你的命令中尝试一下,让我们知道这个解决方案是否有效?
pip install --target ./py_pkg -r requirements.txt --upgrade --no-user
推荐阅读
- python - 为什么访问数组的一个元素可以访问python中的所有其他行?
- python - QProcess完成信号参数lambda函数
- rotation - 在虚幻中转换旋转以实现平滑运动
- php - “php artisan ui vue --auth”命令和“php artisan ui:auth”有什么区别
- mysql - 使用 MySQL 删除 JSON 字段中的日期对象
- mongodb - 使用 NestJS 的 MongoDB 查询获取没有不需要的数据
- javascript - 节点列表索引访问返回未定义
- c - 方法调用后变量突然超出范围
- python - 将列表传递为具有不完整列表/缺失列表条目的输入参数的优雅方式
- twitter-bootstrap - 使用 wtf.form_field 和 bootstrap 时如何使表单标签和输入字段内联