-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
streamline installation instructions
- Loading branch information
César Román
committed
Aug 31, 2021
1 parent
97b040c
commit 165404e
Showing
1 changed file
with
43 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,51 +10,70 @@ tags: | |
- tutorial | ||
- macos | ||
date: 2021-06-28 13:10 -0700 | ||
last-updated: 2021-07-01 20:07 -0700 | ||
last-updated: 2021-08-31 08:13 -0700 | ||
--- | ||
Hello, friends! | ||
|
||
As I have [mentioned before]({{ site.url }}/2020/09/21/working-with-pyenv-on-macos/), I am using [`pyenv`](https://github.com/pyenv/pyenv) to manage multiple Python installations, but since I installed some Hombrew formulae that depend on [`[email protected]`](https://formulae.brew.sh/formula/[email protected]) I decided to uninstall Python 3 installed via `pyenv` and use the one from Homebrew. | ||
|
||
So here I will share a quick guide on how I accomplished that. | ||
|
||
1. If you've installed Python `3.9.5` via `pyenv`, uninstall it by running `uninstall` and then `rehash` | ||
1. If you've installed the latest Python `3.9` version via `pyenv`, uninstall it by running `uninstall` and then `rehash` | ||
|
||
```bash | ||
$ pyenv uninstall 3.9.5 | ||
$ pyenv uninstall 3.9.X | ||
$ pyenv rehash | ||
``` | ||
|
||
1. Create a `symlink` at `~/.pyenv/versions` | ||
|
||
```bash | ||
$ cd ~/.pyenv/versions | ||
$ ln -sfv /usr/local/Cellar/[email protected]/3.9.5/Frameworks/Python.framework/Versions/3.9 3.9.5 | ||
$ ln -sfv "$(brew --prefix [email protected])" 3.9 | ||
$ ls -al | ||
total 0 | ||
drwxr-xr-x 5 thecesrom staff 160 Jun 8 11:08 . | ||
drwxr-xr-x 6 thecesrom staff 192 Jun 8 10:58 .. | ||
drwxr-xr-x 7 thecesrom staff 224 Jun 8 10:58 2.7.18 | ||
lrwxr-xr-x 1 thecesrom staff 75 Jun 8 11:08 3.9.5 -> /usr/local/Cellar/python@3.9/3.9.5/Frameworks/Python.framework/Versions/3.9 | ||
drwxr-xr-x 4 thecesrom staff 128 Aug 31 07:51 . | ||
drwxr-xr-x 6 thecesrom staff 192 Jun 8 10:58 .. | ||
drwxr-xr-x 6 thecesrom staff 192 Aug 31 07:48 2.7.18 | ||
lrwxr-xr-x 1 thecesrom staff 25 Aug 31 07:51 3.9 -> /usr/local/opt/[email protected] | ||
``` | ||
|
||
{: .box-note} | ||
I chose `/usr/local/Cellar/[email protected]/3.9.5/Frameworks/Python.framework/Versions/3.9` instead of `/usr/local/Cellar/[email protected]/3.9.5` because I wanted to include the same folders (`bin`, `include`, `lib`, `share`) as my other Python installation (`2.7.18`), which I installed via `pyenv`. | ||
1. If you wish to also include the `include` directory, run the following | ||
|
||
```bash | ||
$ cd "$(brew --prefix [email protected])" | ||
$ ln -sfv Frameworks/Python.framework/Versions/3.9/include/python3.9 include | ||
include -> Frameworks/Python.framework/Versions/3.9/include/python3.9 | ||
$ ls -al | ||
total 64 | ||
drwxr-xr-x 14 thecesrom staff 448 Aug 31 07:43 . | ||
drwxr-xr-x 3 thecesrom staff 96 Jul 3 09:36 .. | ||
drwxr-xr-x 3 thecesrom staff 96 Jun 28 01:57 .brew | ||
drwxr-xr-x 3 thecesrom staff 96 Jun 28 01:57 Frameworks | ||
drwxr-xr-x 3 thecesrom staff 96 Jun 28 01:57 IDLE 3.app | ||
-rw-r--r-- 1 thecesrom staff 3770 Jul 3 09:36 INSTALL_RECEIPT.json | ||
-rw-r--r-- 1 thecesrom staff 13925 Jun 28 01:57 LICENSE | ||
drwxr-xr-x 3 thecesrom staff 96 Jun 28 01:57 Python Launcher 3.app | ||
-rw-r--r-- 1 thecesrom staff 10140 Jun 28 01:57 README.rst | ||
drwxr-xr-x 19 thecesrom staff 608 Aug 31 07:50 bin | ||
lrwxr-xr-x 1 thecesrom staff 58 Aug 31 07:43 include -> Frameworks/Python.framework/Versions/3.9/include/python3.9 | ||
drwxr-xr-x 3 thecesrom staff 96 Jun 28 01:57 lib | ||
drwxr-xr-x 4 thecesrom staff 128 Jun 28 01:57 libexec | ||
drwxr-xr-x 3 thecesrom staff 96 Jun 28 01:57 share | ||
``` | ||
|
||
1. Create `symlinks` for `idle`, `pip`, `python` and `wheel` at the following location: | ||
|
||
```bash | ||
$ cd /usr/local/Cellar/[email protected]/3.9.5/Frameworks/Python.framework/Versions/3.9/bin | ||
$ ln -sfv idle3.9 idle | ||
idle -> idle3.9 | ||
$ ln -sfv /usr/local/Cellar/[email protected]/3.9.5/bin/pip3 pip | ||
pip -> /usr/local/Cellar/[email protected]/3.9.5/bin/pip3 | ||
$ ln -sfv /usr/local/Cellar/[email protected]/3.9.5/bin/pip3 pip3 | ||
pip3 -> /usr/local/Cellar/[email protected]/3.9.5/bin/pip3 | ||
$ cd "$(brew --prefix [email protected])/bin" | ||
$ ln -sfv idle3 idle | ||
idle -> idle3 | ||
$ ln -sfv pip3 pip | ||
pip -> pip3 | ||
$ ln -sfv python3 python | ||
python -> python3 | ||
$ ln -sfv /usr/local/Cellar/[email protected]/3.9.5/bin/wheel3 wheel | ||
wheel -> /usr/local/Cellar/[email protected]/3.9.5/bin/wheel3 | ||
$ ln -sfv wheel3 wheel | ||
wheel -> wheel3 | ||
``` | ||
|
||
1. Once that's done, run `pyenv rehash` as recommended by `pyenv` whenever you install new versions | ||
|
@@ -69,13 +88,13 @@ So here I will share a quick guide on how I accomplished that. | |
$ pyenv versions | ||
* system (set by /Users/thecesrom/.pyenv/version) | ||
2.7.18 | ||
3.9.5 | ||
3.9 | ||
``` | ||
|
||
1. If you want to set `3.9.5` as global, just run by running | ||
1. If you want to set `3.9` as global, just run by running | ||
|
||
```bash | ||
$ pyenv global 3.9.5 | ||
$ pyenv global 3.9 | ||
``` | ||
|
||
1. Verify your selection by running | ||
|
@@ -84,14 +103,14 @@ So here I will share a quick guide on how I accomplished that. | |
$ pyenv versions | ||
system | ||
2.7.18 | ||
* 3.9.5 (set by /Users/thecesrom/.pyenv/version) | ||
* 3.9 (set by /Users/thecesrom/.pyenv/version) | ||
``` | ||
|
||
1. And now when I run `python --version` I get the following output: | ||
|
||
```bash | ||
$ python --version | ||
Python 3.9.5 | ||
Python 3.9.6 | ||
``` | ||
|
||
And that's it! You've done it! | ||
|