Set up Smorphi Blockly for MacOS
In order to use Smorphi-Blockly on MacOS, you need to install python 3.9 or below. It is recommended to use pyenv
as a Python Version Manager on MacOS.
Here’s a step-by-step guide:
Installing pyenv
It is highly recommended to use Homebrew
to install software packages.
-
Install Homebrew (if not already installed): Homebrew is a package manager for macOS that makes it easy to install software packages.
Follow the instructure here: https://brew.sh/ or execute the command below in your terminal.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
-
Install
pyenv
using Homebrew:brew install pyenv
-
Set up
pyenv
in your shell: First, add the commands to~/.bashrc
by running the following in your terminal:echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc echo 'command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc echo 'eval "$(pyenv init -)"' >> ~/.bashrc
Then, if you have
~/.profile
,~/.bash_profile
or~/.bash_login
, add the commands there as well. If you have none of these, add them to~/.profile
.-
to add to
~/.profile
:echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.profile echo 'command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.profile echo 'eval "$(pyenv init -)"' >> ~/.profile
-
-
Restart your shell
for the
PATH
changes to take effect.exec "$SHELL"
Using pyenv
to Install and Manage Python Versions
-
(Optional) List available Python versions: To see which versions of Python are available for installation:
pyenv install --list
-
Install a specific Python version: Install a Python version using
pyenv
:pyenv install 3.9.19
-
Set a global Python version or set a local Python version (per directory):
[Recommended!] Set a specific Python version locally (applies only to the current directory and its subdirectories):
cd ~/Downloads/Smorphi/Smorphi-Blockly-main
pyenv local 3.9.19
Set a specific Python version globally (applies to all shells):
pyenv global 3.9.19
-
Activate the virtual environment:
Make sure you’re in the project direcitory:
cd ~/Downloads/Smorphi/Smorphi-Blockly-main
then run:
source myenv/bin/activate
Run the project:
- Make sure you’re in the project directory
- Run the command:
python start.py
Deactivate the virtual environment:
You can deactivate the virtual environment after work is done.
deactivate