完成在m1下的86python环境

在我的x86架构的python环境

==> Summary
  /usr/local/Cellar/[email protected]/3.10.9: 3,108 files, 56.4MB
==> Running `brew cleanup [email protected]`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
==> Caveats
==> [email protected]
Python has been installed as
  /usr/local/bin/python3

Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to
`python3`, `python3-config`, `pip3` etc., respectively, have been installed into
  /usr/local/opt/[email protected]/libexec/bin

You can install Python packages with
  pip3 install <package>
They will install into the site-package directory
  /usr/local/lib/python3.10/site-packages

tkinter is no longer included with this formula, but it is available separately:
  brew install [email protected]

86的python环境

arch -x86_64 /usr/local/bin/python3 -m venv mediapipe
source ~/mediapipe/bin/activate

参考:

第一步 在 访达(Finder) 中启用Rosetta

打开访达,搜索"Terminal"
看见“终端”的图标之后,鼠标右击图标,点选“显示简介”
如下图,勾选“使用Rosetta打开”

第二步 关闭原来的终端,新建一个Terminal窗口

Command (⌘)-空格键,输入terminal,按下回车键。

第三步 安装HomeBrew

/bin/zsh -c “$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)”
⬆️根据大佬的提示,选择下载源,操作即可⬆️

第四步 安装非Arm架构的python

arch -x86_64 /usr/local/homebrew/bin/brew install [email protected]
第五步 创建一个新的虚拟环境

arch -x86_64 /usr/local/homebrew/opt/[email protected]/bin/python3 -m venv myvenv
第六步 启动虚拟环境

source ~/myvenv/bin/activate
第七步 安装mediapipe

pip3 install mediapipe -i https://pypi.tuna.tsinghua.edu.cn/simple
ok啦大功告成~

python3
import mediapipe
如果没有报错,那么恭喜你成功安装了mediapipe.

如果想要继续配置pycharm,在pycharm里面使用mediapipe,请继续往下看:

(注:安装的是m1版本的社区版pycharm)

第八步 选择interpreter

在PyCharm中新建project的时候,在"interpreter"一栏目,根据安装地址,点击右侧(···)
选择: /usr/local/homebrew/opt/[email protected]/bin/python3

第九步 安装mediapipe

    在pycharm底部点击"Terminal",输入如下命令

pip3 install mediapipe -i https://pypi.tuna.tsinghua.edu.cn/simple
over了~
————————————————
版权声明:本文为CSDN博主「AntonioD」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/weixin_42735755/article/details/122182398

你可能感兴趣的:(python,pycharm,开发语言)