“解决Pycharm安装第三方库时出现的错误:no such option: –build-dir”

Pycharm 安装第三方库报错及解决方案——no such option: –build-dir

Pycharm 安装第三方库报错及解决方案——no such option: –build-dir

最近在学习路径规划相关内容,在运行GitHub上下载例程时缺少“plotly”库,根据网上查到的安装步骤操作,结果安装失败,下面将对错误进行分析并给出正确的解决方案。

Pycharm安装库的步骤

点击文件

点击设置

自动跳转到python解释器
这里要注意正确配置并选择解释器,我安装的Python3.9

点击“+”

搜索缺少的库,我这里是“plotly”
勾选install to user’s site packages directory
点击安装包
正常等待一会就可成功安装。但是我在这里出错了

Pycharm安装库报错及解决方案

安装过程报错,有两段错误提示
1、Try to run this command from the system terminal. Make sure that you use the correct version of ‘pip’ installed for your Python interpreter located at ‘D:\Python3.9\python.exe’。
2、no such option: –build-dir。
根据第一个错误提示查找资料,给出的原因是pycharm里安装的pip与电脑中按照的pip版本不一致。但我查了下我的pip版本一致而且是最新版本,具体操作流程参考链接: link.https://www.jianshu.com/p/8b9281521116. 此方案没有解决问题。

根据第二个提示,找到的原因是PyCharm依赖于"–build-dir"参数安装第三方库,但该参数在最新的23.0版pip中已删除。 link.https://stackoverflow.com/questions/65085956/pycharm-venv-failed-no-such-option-build-dir.
解决办法就是降级pip,等待PyCharm更新就可以了。
首先关闭Pycharm,然后在cmd状态下运行python -m pip install pip==20.2.4,pip降级完成后即可正常搜索安装第三方库。

物联沃分享整理
物联沃-IOTWORD物联网 » “解决Pycharm安装第三方库时出现的错误:no such option: –build-dir”

发表评论