<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Jordi Cuevas</title>
    <description>The latest articles on Forem by Jordi Cuevas (@jordicuevas).</description>
    <link>https://forem.com/jordicuevas</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F344745%2F3016f28c-5334-4f79-b7aa-8a3428f1fd94.jpeg</url>
      <title>Forem: Jordi Cuevas</title>
      <link>https://forem.com/jordicuevas</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/jordicuevas"/>
    <language>en</language>
    <item>
      <title>How to install python2 in a macbook M1 with brew</title>
      <dc:creator>Jordi Cuevas</dc:creator>
      <pubDate>Fri, 20 May 2022 13:57:31 +0000</pubDate>
      <link>https://forem.com/jordicuevas/how-to-install-python2-in-a-macbook-m1-with-brew-bhi</link>
      <guid>https://forem.com/jordicuevas/how-to-install-python2-in-a-macbook-m1-with-brew-bhi</guid>
      <description>&lt;p&gt;Today, I need it to clone a repository of a project I'm working on, and after I run&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;it returns python2 executable not found. so here are the steps to install python in your macbook.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Steps&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;First of all , you should have installed brew.&lt;/li&gt;
&lt;li&gt;After you install brew run the following command
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;brew install pyenv
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;pyenv&lt;/strong&gt; (python version management) will help us on having multiple python versions in our pc. &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;After the installation of pyenv we can now proceed to install the required python version we need with the following command:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pyenv install 2.7.18

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;once the installation completes we can export our env variables like this
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export PATH="$(pyenv root)/shims:${PATH}"

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;echo 'PATH=$(pyenv root)/shims:$PATH' &amp;gt;&amp;gt; ~/.zshrc

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After restarting my shell and try to install the dependencies of the project I found one more time there is not a python2 executable , but you are wondering what I did wrong? if I just installed it. Well we need to tell &lt;strong&gt;pyenv&lt;/strong&gt; to use the version of python running the following command in our terminal&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pyenv init

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Make sure to follow the instructions for configuration, and after restarting your terminal we can tell our shell to use the python version we need&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pyenv shell 2.7.18

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and that's it , we have now python2 configure in our macbook.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>macos</category>
      <category>python</category>
      <category>brew</category>
    </item>
  </channel>
</rss>
