title: zsh: command not found python after running "brew upgrade"
body: <p>I am not able to install any npm packages as I get the following error on my M1 Mac mini</p>
  <pre><code>npm WARN deprecated @types/anymatch@3.0.0: This is a stub types definition. anymatch provides its own type definitions, so you do not need this installed.
  npm WARN deprecated @types/browserslist@4.15.0: This is a stub types definition. browserslist provides its own type definitions, so you do not need this installed.
  npm WARN deprecated async-cache@1.1.0: No longer maintained. Use [lru-cache](http://npm.im/lru-cache) version 7.6 or higher, and provide an asynchronous `fetchMethod` option.
  npm WARN deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
  npm WARN deprecated flatten@1.0.3: flatten is deprecated in favor of utility frameworks such as lodash.
  npm WARN deprecated @stylelint/postcss-markdown@0.36.2: Use the original unforked package instead: postcss-markdown
  npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
  npm WARN deprecated har-validator@5.1.5: this library is no longer supported
  npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
  npm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
  npm WARN deprecated xmldom@0.1.31: Deprecated due to CVE-2021-21366 resolved in 0.5.0
  npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
  npm WARN deprecated chokidar@2.1.8: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
  npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
  npm WARN deprecated babel-eslint@10.1.0: babel-eslint is now @babel/eslint-parser. This package will no longer receive updates.
  npm WARN deprecated uuid@3.3.2: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
  npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
  npm WARN deprecated ecstatic@3.3.2: This package is unmaintained and deprecated. See the GH Issue 259.
  npm WARN deprecated svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
  npm WARN deprecated tar@2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.
  npm WARN deprecated core-js@2.6.12: core-js@&lt;3.4 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
  npm WARN deprecated core-js@2.6.12: core-js@&lt;3.4 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
  npm ERR! code 1
  npm ERR! path /Users/vr/Desktop/code/ch_v3_final/node_modules/deasync
  npm ERR! command failed
  npm ERR! command sh -c node ./build.js
  npm ERR! gyp info it worked if it ends with ok
  npm ERR! gyp info using node-gyp@3.8.0
  npm ERR! gyp info using node@16.14.2 | darwin | arm64
  npm ERR! gyp ERR! configure error 
  npm ERR! gyp ERR! stack Error: Can't find Python executable &quot;python&quot;, you can set the PYTHON env variable.
  npm ERR! gyp ERR! stack     at PythonFinder.failNoPython (/Users/vr/Desktop/code/ch_v3_final/node_modules/node-gyp/lib/configure.js:484:19)
  npm ERR! gyp ERR! stack     at PythonFinder.&lt;anonymous&gt; (/Users/vr/Desktop/code/ch_v3_final/node_modules/node-gyp/lib/configure.js:406:16)
  npm ERR! gyp ERR! stack     at F (/Users/vr/Desktop/code/ch_v3_final/node_modules/node-gyp/node_modules/which/which.js:68:16)
  npm ERR! gyp ERR! stack     at E (/Users/vr/Desktop/code/ch_v3_final/node_modules/node-gyp/node_modules/which/which.js:80:29)
  npm ERR! gyp ERR! stack     at /Users/vr/Desktop/code/ch_v3_final/node_modules/node-gyp/node_modules/which/which.js:89:16
  npm ERR! gyp ERR! stack     at /Users/vr/Desktop/code/ch_v3_final/node_modules/isexe/index.js:42:5
  npm ERR! gyp ERR! stack     at /Users/vr/Desktop/code/ch_v3_final/node_modules/isexe/mode.js:8:5
  npm ERR! gyp ERR! stack     at FSReqCallback.oncomplete (node:fs:198:21)
  npm ERR! gyp ERR! System Darwin 21.4.0
  npm ERR! gyp ERR! command &quot;/Users/vr/.nvm/versions/node/v16.14.2/bin/node&quot; &quot;/Users/vr/Desktop/code/ch_v3_final/node_modules/.bin/node-gyp&quot; &quot;rebuild&quot;
  npm ERR! gyp ERR! cwd /Users/vr/Desktop/code/ch_v3_final/node_modules/deasync
  npm ERR! gyp ERR! node -v v16.14.2
  npm ERR! gyp ERR! node-gyp -v v3.8.0
  npm ERR! gyp ERR! not ok 
  npm ERR! Build failed
  
  npm ERR! A complete log of this run can be found in:
  npm ERR!     /Users/vr/.npm/_logs/2022-03-23T03_16_33_423Z-debug-0.log
  </code></pre>
  <p>I understand that python is not installed so I tried running the python command</p>
  <pre><code>python
  zsh: command not found: python
  </code></pre>
  <p>When I run python3 it works perfectly however
  I have installed python3 using pyenv which was installed using homebrew</p>
  <p>I understand the path is not added, this is what my ~/.zshrc file looks like</p>
  <pre><code>export NVM_DIR=&quot;$HOME/.nvm&quot;
  [ -s &quot;$NVM_DIR/nvm.sh&quot; ] &amp;&amp; . &quot;$NVM_DIR/nvm.sh&quot;  # This loads nvm
  [ -s &quot;$NVM_DIR/bash_completion&quot; ] &amp;&amp; . &quot;$NVM_DIR/bash_completion&quot;  # This loads nvm bash_completion
  source ~/.nvm/nvm.sh
  
  
  export PYENV_ROOT=&quot;$HOME/.pyenv&quot;
  export PATH=&quot;$PYENV_ROOT/bin:$PATH&quot;
  eval &quot;$(pyenv init -)&quot;
  </code></pre>
  <p>How do I make the python command work? Spent almost 12 hours and havent solved this yet.</p>
  <p><strong>What I have tried</strong></p>
  <pre><code>brew install python@2
  </code></pre>
  <p>It says</p>
  <pre><code>Warning: No available formula with the name &quot;python@2&quot;. Did you mean ipython, bpython, jython or cython?
  ==&gt; Searching for similarly named formulae...
  These similarly named formulae were found:
  ipython                                                             bpython                                                             jython                                                              cython
  To install one of them, run (for example):
    brew install ipython
  ==&gt; Searching for a previously deleted formula (in the last month)...
  Error: No previously deleted formula found.
  ==&gt; Searching taps on GitHub...
  Error: No formulae found in taps.
  </code></pre>
  <p><strong>UPDATE 1</strong>
  I did what @ElapsedSoul in the comments has written but it gives a new error now. this must be the Python 2 not compatible error. Unfortunately doing brew install python@2 doesnt work either, what to do?</p>
  <pre><code>npm WARN deprecated @types/anymatch@3.0.0: This is a stub types definition. anymatch provides its own type definitions, so you do not need this installed.
  npm WARN deprecated @types/browserslist@4.15.0: This is a stub types definition. browserslist provides its own type definitions, so you do not need this installed.
  npm WARN deprecated async-cache@1.1.0: No longer maintained. Use [lru-cache](http://npm.im/lru-cache) version 7.6 or higher, and provide an asynchronous `fetchMethod` option.
  npm WARN deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
  npm WARN deprecated flatten@1.0.3: flatten is deprecated in favor of utility frameworks such as lodash.
  npm WARN deprecated @stylelint/postcss-markdown@0.36.2: Use the original unforked package instead: postcss-markdown
  npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
  npm WARN deprecated har-validator@5.1.5: this library is no longer supported
  npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
  npm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
  npm WARN deprecated xmldom@0.1.31: Deprecated due to CVE-2021-21366 resolved in 0.5.0
  npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
  npm WARN deprecated chokidar@2.1.8: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
  npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
  npm WARN deprecated babel-eslint@10.1.0: babel-eslint is now @babel/eslint-parser. This package will no longer receive updates.
  npm WARN deprecated uuid@3.3.2: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
  npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
  npm WARN deprecated ecstatic@3.3.2: This package is unmaintained and deprecated. See the GH Issue 259.
  npm WARN deprecated svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
  npm WARN deprecated tar@2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.
  npm WARN deprecated core-js@2.6.12: core-js@&lt;3.4 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
  npm WARN deprecated core-js@2.6.12: core-js@&lt;3.4 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
  npm ERR! code 1
  npm ERR! path /Users/vr/Desktop/code/ch_v3_final/node_modules/deasync
  npm ERR! command failed
  npm ERR! command sh -c node ./build.js
  npm ERR! gyp info it worked if it ends with ok
  npm ERR! gyp info using node-gyp@3.8.0
  npm ERR! gyp info using node@16.14.2 | darwin | arm64
  npm ERR! gyp ERR! configure error 
  npm ERR! gyp ERR! stack Error: Command failed: /usr/local/bin/python -c import sys; print &quot;%s.%s.%s&quot; % sys.version_info[:3];
  npm ERR! gyp ERR! stack   File &quot;&lt;string&gt;&quot;, line 1
  npm ERR! gyp ERR! stack     import sys; print &quot;%s.%s.%s&quot; % sys.version_info[:3];
  npm ERR! gyp ERR! stack                       ^
  npm ERR! gyp ERR! stack SyntaxError: invalid syntax
  npm ERR! gyp ERR! stack 
  npm ERR! gyp ERR! stack     at ChildProcess.exithandler (node:child_process:399:12)
  npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:526:28)
  npm ERR! gyp ERR! stack     at maybeClose (node:internal/child_process:1092:16)
  npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)
  npm ERR! gyp ERR! System Darwin 21.4.0
  npm ERR! gyp ERR! command &quot;/Users/vr/.nvm/versions/node/v16.14.2/bin/node&quot; &quot;/Users/vr/Desktop/code/ch_v3_final/node_modules/.bin/node-gyp&quot; &quot;rebuild&quot;
  npm ERR! gyp ERR! cwd /Users/vr/Desktop/code/ch_v3_final/node_modules/deasync
  npm ERR! gyp ERR! node -v v16.14.2
  npm ERR! gyp ERR! node-gyp -v v3.8.0
  npm ERR! gyp ERR! not ok 
  npm ERR! Build failed
  
  npm ERR! A complete log of this run can be found in:
  npm ERR!     /Users/vr/.npm/_logs/2022-03-23T09_28_32_986Z-debug-0.log
  </code></pre>