Skip to content

Instantly share code, notes, and snippets.

@MxJ24
Created March 6, 2021 03:22
Show Gist options
  • Save MxJ24/19482861156b9b4ef24928f3c49a89f5 to your computer and use it in GitHub Desktop.
Save MxJ24/19482861156b9b4ef24928f3c49a89f5 to your computer and use it in GitHub Desktop.
-- 关闭 SIP (csrutil disable)
重启M1电脑,按住开机键不放直到进入系统恢复模式,打开终端,输入 csrutil disable 回车,然后根据引导操作,并重启电脑
如果不关闭,python 命令无法在虚拟环境运行,症状为 zsh killed
ref: https://github.com/pypa/virtualenv/issues/2023
-- 以x86_64方式运行终端
arch -x86_64 $SHELL
ref: https://sspai.com/post/63935
-- 卸载 brew (如需重新安装先卸载)
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
-- 安装x86_64 brew
https://brew.sh/
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
which brew
/usr/local/bin/brew -> x86_64
/opt/homebrew/bin/brew -> arm
-- 卸载 x86_64 mysql (如需卸载)
#Library not loaded: /usr/local/opt/mysql/lib/libmysqlclient.20.dylib
brew services stop mysql
brew uninstall --force mysql
rm -R /usr/local/var/mysql
brew install mysql@5.7
brew services start mysql@5.7
brew link mysql@5.7 --force
-- 卸载 arm mysql (如需卸载)
brew uninstall mysql
-- 安装x86_64 mysql
arch -x86_64 brew install mysql@5.7
-- 安装 arm mysql (不建议安装这个版本)
arch -arm64 /opt/homebrew/bin/brew install mysql
-- 安装pip
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3 get-pip.py
-- 安装python虚拟环境
mkdir -p ~/workspace/envs;
cd ~/workspace/envs;arch -x86_64 virtualenv -p $(which python) misv2
cd ~/workspace/envs;source ./misv2/bin/activate;cd ~/workspace/misv2
arch -x86_64 $(which python) -m pip install -i https://pypi.douban.com/simple/ -r requirement.txt
-- x86_64 brew 编译MySQL-python
env LDFLAGS="-L$(/usr/local/bin/brew --prefix openssl)/lib" CFLAGS="-I$(/usr/local/bin/brew --prefix openssl)/include"
LDFLAGS=-L/usr/local/opt/openssl/lib arch -x86_64 $(which python) -m pip install -i https://pypi.douban.com/simple/ MySQL-python==1.2.5
ref: https://github.com/PyMySQL/mysqlclient/issues/131
-- 启动后端服务器
arch -x86_64 python manage.py runserver
-- 安装node
brew update
brew install node
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment