PyCharm venv 失败:'没有这样的选项:--build-dir' [英] PyCharm venv failed: 'no such option: --build-dir'

查看:531
本文介绍了PyCharm venv 失败:'没有这样的选项:--build-dir'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在新的 Windows 10 笔记本电脑上进行全新安装.我安装了 Python 3.9 和 PyCharm Community 2020.2,然后开始了一个新项目.在项目设置中,我在/venv 文件夹内的 venv 中创建了一个新的项目解释器.一切看起来都设置正确,但我无法在项目解释器中安装任何东西.当我尝试这样做时,例如当我尝试安装 Pandas 或其他任何东西时,我收到非零退出代码 (2) 并显示以下消息:

I'm doing a fresh install on a new Windows 10 laptop. I installed Python 3.9 and PyCharm Community 2020.2, then started a new project. In the project settings, I created a new project interpreter in a venv, inside the /venv folder. Everything looks to get set up correctly, but I can't install anything to the project interpreter. When I try to do so, e.g. when I try to install pandas or anything else, I get None-zero exit code (2) with the following message:

用法:D:\MyProject\project\venv\Scripts\python.exe -m pip install[选项] [包索引选项] ...
D:\MyProject\project\venv\Scripts\python.exe -m pip install [选项] -r[包索引选项] ...
D:\MyProject\project\venv\Scripts\python.exe -m pip install [选项][-e] ...
D:\MyProject\project\venv\Scripts\python.exe -m pip install [选项][-e] ...
D:\MyProject\project\venv\Scripts\python.exe -m pip install [选项]<存档网址/路径>...

Usage: D:\MyProject\project\venv\Scripts\python.exe -m pip install [options] [package-index-options] ...
D:\MyProject\project\venv\Scripts\python.exe -m pip install [options] -r [package-index-options] ...
D:\MyProject\project\venv\Scripts\python.exe -m pip install [options] [-e] ...
D:\MyProject\project\venv\Scripts\python.exe -m pip install [options] [-e] ...
D:\MyProject\project\venv\Scripts\python.exe -m pip install [options] <archive url/path> ...

没有这样的选项:--build-dir

no such option: --build-dir

当我转到终端并根据 PyCharm 的建议解决方案"执行pip install pandas"时,它安装正常,并且 pandas 及其依赖项照常出现在解释器的已安装模块列表中.我以前没有遇到过这种情况,并且在设置中没有任何地方可以指定 PyCharm 在这种情况下将如何调用 pip.

When I go to the Terminal and just 'pip install pandas' per PyCharm's 'proposed solution', it installs fine, and pandas and its dependencies appear as usual in the list of installed modules in the interpreter. I've not encountered this before, and don't see anywhere in the settings where I can specify how exactly PyCharm will invoke pip in this situation.

推荐答案

PyCharm 依赖 --build-dir 来安装包和标志 在最新的 pip 20.3 中被移除.

PyCharm relies on --build-dir to install packages and the flag was removed in the latest pip 20.3.

PyCharm 的修复已准备就绪,将于本周在 2020.3 版本中发布(并反向移植到 2020.2.5 和 2020.1.5).

The fix for PyCharm is ready and will be released this week in 2020.3 release (and backported to 2020.2.5 and 2020.1.5).

解决方法是将pip降级到之前的版本——关闭PyCharm并在终端中使用对应的虚拟机运行python -m pip install pip==20.2.4环境.

The workaround is to downgrade pip to the previous version - close PyCharm and run python -m pip install pip==20.2.4 in the terminal using the corresponding virtual environment.

2020.1.5 和 2020.2.5 已发布修复 - 请更新.

2020.1.5 and 2020.2.5 with the fix were released - please update.

这篇关于PyCharm venv 失败:'没有这样的选项:--build-dir'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆