hhstore / blog

My Tech Blog: about Mojo / Rust / Golang / Python / Kotlin / Flutter / VueJS / Blockchain etc.
https://github.com/hhstore/blog/issues
294 stars 24 forks source link

Mojo: Quickstart - Setup on MacOS(M1) #413

Open hhstore opened 1 year ago

hhstore commented 1 year ago

📖 Abstract:

💯 Related:

hhstore commented 1 year ago

M1 Mac 安装 mojo 教程

适用范围:

开荒 & 吃螃蟹态度:

踩坑说明:

macos 版本问题:

python 🐍 版本问题:


# 卸载 rye:
rye self uninstall

# 设置全局 Python 版本:
❯ pyenv versions
  system
  3.9.13
  3.9.13
  3.10.5
* 3.10.6 (set by /Users/dev/.pyenv/version)

# 正常状态:
❯ which python
/Users/dev/.pyenv/shims/python

网络🪜问题:

下载速度:

hhstore commented 1 year ago

M1 Mac 安装流程:

安装 modular:


# 安装 modular:
curl https://get.modular.com | \
  MODULAR_AUTH=mut_a27b34525bed433bb61ea88654a814bb \
  sh -

# 查看 modular 安装成功:
❯ modular -v
modular 0.2.1 (5144fffe)

安装 mojo:


# auth:
modular auth mut_a27b34525bed433bb61ea88654a814bb

# 一键安装命令, 如果失败, 重试几次:
modular clean && modular auth mut_a27b34525bed433bb61ea88654a814bb &&
modular install mojo
image image

添加环境变量:

# for mojo:
set -gx MODULAR_HOME "$HOME/.modular"
set -gx PATH "$PATH:$MODULAR_HOME/pkg/packages.modular.com_mojo/bin"

echo 'export MODULAR_HOME="/Users/dev/.modular"' >> ~/.zshrc
echo 'export PATH="/Users/dev/.modular/pkg/packages.modular.com_mojo/bin:$PATH"' >> ~/.zshrc

# 激活:
source ~/.zshrc

echo 'export MODULAR_HOME="/Users/dev/.modular"' >> ~/.bashrc
echo 'export PATH="/Users/dev/.modular/pkg/packages.modular.com_mojo/bin:$PATH"' >> ~/.bashrc

# 激活:
source ~/.bashrc
hhstore commented 1 year ago

Vscode 配置 Mojo 开发环境:

安装 vscode 插件:

mojo 插件设置环境变量:

配置完成效果:

image

欢迎关注如下几个 repos/orgs:

hhstore commented 1 year ago

1

hhstore commented 1 year ago

1

hhstore commented 1 year ago

1

hhstore commented 1 year ago

1