Error: Can‘t find Python executable “python“, you can set the PYTHON env variable.解决办法

这篇具有很好参考价值的文章主要介绍了Error: Can‘t find Python executable “python“, you can set the PYTHON env variable.解决办法。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

😦电脑磕坏了

   最近把公司给的mac屏幕给磕坏了,换成自己的macbookpro,本来想用时间机器做个无缝衔接,结果发现不能用了,跟客服沟通被告知macos版本在11以上不支持时间机器系统迁移,只能使用迁移助理做数据备份,非常痛苦!!!要重新安装各种环境,各种软件!!!!😤😤😤😤😤

🌟🌟🌟努力安装软件

   安装了很多开发常用的工具,就不一一罗列了。还有各种环境配置,经过两天的时间,差不多达到了以前环境的80%,还有一些细节需要优化,工欲善其事,必先利其器。
   于是我开始跑前端项目,安装完了nodejs,当我用npm i编译时,给我来了一大段报错

gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack     at PythonFinder.failNoPython (/Users/scott/project/dx_project/front_project/workflow-frontend-elem/node_modules/node-gyp/lib/configure.js:484:19)
gyp ERR! stack     at PythonFinder.<anonymous> (/Users/scott/project/dx_project/front_project/workflow-frontend-elem/node_modules/node-gyp/lib/configure.js:406:16)
gyp ERR! stack     at F (/Users/scott/project/dx_project/front_project/workflow-frontend-elem/node_modules/which/which.js:68:16)
gyp ERR! stack     at E (/Users/scott/project/dx_project/front_project/workflow-frontend-elem/node_modules/which/which.js:80:29)
gyp ERR! stack     at /Users/scott/project/dx_project/front_project/workflow-frontend-elem/node_modules/which/which.js:89:16
gyp ERR! stack     at /Users/scott/project/dx_project/front_project/workflow-frontend-elem/node_modules/isexe/index.js:42:5
gyp ERR! stack     at /Users/scott/project/dx_project/front_project/workflow-frontend-elem/node_modules/isexe/mode.js:8:5
gyp ERR! stack     at FSReqCallback.oncomplete (fs.js:192:21)
gyp ERR! System Darwin 21.5.0
gyp ERR! command "/usr/local/bin/node" "/Users/scott/project/dx_project/front_project/workflow-frontend-elem/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /Users/scott/project/dx_project/front_project/workflow-frontend-elem/node_modules/node-sass
gyp ERR! node -v v14.17.3
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
Build failed with error code: 1
npm WARN @babel/plugin-proposal-class-static-block@7.18.0 requires a peer of @babel/core@^7.12.0 but none is installed. You must install peer dependencies yourself.
npm WARN @babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@7.17.12 requires a peer of @babel/core@^7.13.0 but none is installed. You must install peer dependencies yourself.
npm WARN @babel/helper-define-polyfill-provider@0.2.4 requires a peer of @babel/core@^7.4.0-0 but none is installed. You must install peer dependencies yourself.
npm WARN @babel/helper-define-polyfill-provider@0.3.1 requires a peer of @babel/core@^7.4.0-0 but none is installed. You must install peer dependencies yourself.
npm WARN diboot-element-admin@2.3.1 No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-sass@4.14.1 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass@4.14.1 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/scott/.npm/_logs/2022-06-08T09_20_09_286Z-debug.log
scott@ScottdeMacBook-Pro workflow-frontend-elem % npm install --save-dev node-sass
npm WARN deprecated tar@2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.

> node-sass@4.14.1 install /Users/scott/project/dx_project/front_project/workflow-frontend-elem/node_modules/node-sass
> node scripts/install.js

Downloading binary from https://github.com/sass/node-sass/releases/download/v4.14.1/darwin-x64-83_binding.node

发现一段错误提示Error: Can‘t find Python executable “python“, you can set the PYTHON env variable,这提示貌也很明显,告诉我们没有python,我在终端检查了一下果然没有。
我记得macos是自带python2.7的,于是我查阅了一下资料,发现Moterey这个版本的操作系统移出了python,需要自己去安装。好吧,认命,我装。
于是我开始使用homebrew安装python3.X。

# 命令大概是这样子
brew install python3
brew link python3

细心的我观察到报错时调用的是’python’命令,于是在.bash_profile中增加了别名配置

alias python3='/usr/bin/python3'
alias python=python3
alias python2=python3

满心欢喜继续执行npm i 进行编译项目,结果还是报错😫😫😫,不过细心的我肯定会注意到这一句提示Downloading binary from https://github.com/sass/node-sass/releases/download/v4.14.1/darwin-x64-83_binding.node,这个node-saas从github去拉,没有拉下来。我不是已经改过了镜像源了么,于是我又查阅了一些资料。于是乎查到了一个命令。

👊👊终极解决方案

没错,我们需要改变它的下载地址👏👏,通过下面这个命令把下载地址改为淘宝镜像。

npm config set sass_binary_site=https://npm.taobao.org/mirrors/node-sass

Error: Can‘t find Python executable “python“, you can set the PYTHON env variable.解决办法

可以看到已经下载好了,这时候我们就可以正常的npm install了,所以有时候遇到问题不要慌,这个解决不了,那么就先解决下一个。🏃🏃只要你跑的够快,bug就追不上你。
点赞收藏,富婆包养文章来源地址https://www.toymoban.com/news/detail-402605.html

到了这里,关于Error: Can‘t find Python executable “python“, you can set the PYTHON env variable.解决办法的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包赞助服务器费用

相关文章

  • ./configure: error: SSL modules require the OpenSSL library. You can either do not enable the module

     Ubuntu22系统,参考nginx文档Support for QUIC and HTTP/3 执行如下命令: 时报错如下: 但其实系统是有openssl库的: ➜  out git:(v1.1.0) ✗ openssl version OpenSSL 3.0.2 15 Mar 2022 (Library: OpenSSL 3.0.2 15 Mar 2022) 必应了一下,参考了这两个:https://forum.nginx.org/read.php?2,299223  #2605 (NGINX + BoringSSL b

    2024年04月27日
    浏览(18)
  • Python:执行py命令,提示: Can‘t find a default Python.

    Python:执行py命令,提示: Can‘t find a default Python.

    今天,要运行一个前年用python编写的爬虫程序,先检测python运行环境是否正常: D:Python38-32worksc:windowspy.exe Can\\\'t find a default Python. 再试: D:Python38-32workspy --list Installed Pythons found by py Launcher for Windows No Installed Pythons Found! C:WINDOWSsystem32 assoc .py=Python.File C:WINDOWSsystem32ftype P

    2024年04月10日
    浏览(7)
  • error: can‘t find Rust compiler

    error: can‘t find Rust compiler

    操作系统 win11 pip install -r requirements.txt 报错如下 解决方法: 去官网下载安装rustup.rs - The Rust toolchain installer 下载完rustup-init.exe,运行安装,会出现窗口提示需要预先安装vs,按默认安装即可。等一会vs安装成功。 需要再次手动运行rustup-init.exe,这次就是正式安装了, 都按模

    2024年02月11日
    浏览(7)
  • Authorization Failed You can close this page and return to the IDE

    Authorization Failed You can close this page and return to the IDE

    注册JetBrains成功,并且通过了学生认证,但在activate pycharm时,却显示Authorization Failed You can close this page and return to the IDE如上图 可能是因为之前使用了破解版pycharm 1.打开文件夹中隐藏的项目 2.找到JeBrains文件夹,在AppData下面,将JeBrains文件夹删除 目录:c盘-用户-AppData 3.找到下

    2024年01月25日
    浏览(9)
  • ​git pull 提示 hint: You can replace “git config“ with “git config --global“ to set a default​

    hint: You can replace \\\"git config\\\" with \\\"git config --global\\\" to set a default hint: preference for all repositories. You can also pass --rebase, --no-rebase, hint: or --ff-only on the command line to override the configured default per hint: invocation. fatal: Need to specify how to reconcile divergent branches. 解决方法: 终端运行:git config p

    2024年02月04日
    浏览(10)
  • ubuntu下,在vscode中使用platformio出现 Can not find working Python 3.6+ Interpreter的问题

    ubuntu下,在vscode中使用platformio出现 Can not find working Python 3.6+ Interpreter的问题

    有一段时间没有使用platformio了,今天突然使用的时候,发现用不了,报错: Ubuntu PlatformIO: Can not find working Python 3.6+ Interpreter. Please install the latest Python 3 and restart VSCode。 上网一查,发现好多人遇到,同时他们也给出了解决办法: 【Ubuntu vscode pio extension install: PlatformIO: Can no

    2024年02月14日
    浏览(13)
  • [ERROR] Error executing Maven.[ERROR] The specified user settings file does not exist:

    [ERROR] Error executing Maven.[ERROR] The specified user settings file does not exist:

    今天在导入JavaEE项目的时候运行时出现了以下错误: [ERROR] Error executing Maven. [ERROR] The specified user settings file does not exist: C:Usersmavenapache-maven-3.6.2-binapache-maven-3.6.2confsettings.xml  解决方法 两种,主要看自己使用的tomcat: 1、 File——Settings,选择正确的Maven安装路径。  2、 点

    2024年02月08日
    浏览(14)
  • Warning: [ant-design-vue: Form.Item] FormItem can only collect one field item, you haved set `ASele

    Warning: [ant-design-vue: Form.Item] FormItem can only collect one field item, you haved set `ASele

    控制台出现这个提示: Warning: [ant-design-vue: Form.Item] FormItem can only collect one field item, you haved set ASelect , ASelect , AInputNumber , AInputNumber , AInput 5 field items. You can set not need to be collected fields into a-form-item-rest table中使用了自定义组件 如图: 解决方案: 详情 官网

    2024年02月11日
    浏览(10)
  • electron打包运行白屏、Can not find modules ‘xxx‘,Dynamic Linking Error等问题

    原因:应该写在dependencies里的写在了devDependencies,或者相反。有些依赖写反了是可以运行的,但是打包不行 在Electron项目中的package.json文件中,dependencies和devDependencies都是用来声明应用程序所依赖的npm包的。它们之间的区别在于: dependencies dependencies是指应用程序在运行时所

    2024年02月08日
    浏览(11)
  • 解决PyCharm安装其他库包时出现的“error: can‘t find Rust compiler“错误

    解决PyCharm安装其他库包时出现的\\\"error: can’t find Rust compiler\\\"错误 在使用PyCharm安装其他Python库包时,有时候会遇到\\\"error: can’t find Rust compiler\\\"的错误提示。这个错误通常是由于缺少Rust编译器导致的。Rust是一种系统级编程语言,一些Python库包在安装过程中需要使用Rust编译器来编

    2024年03月23日
    浏览(19)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包