简体   繁体   English

在 Apple Silicon 上找到 python

[英]Finding python on Apple Silicon

I have installed Python on my Apple Silicon (ARM64) machine, but it installs it as python3 and not python .我已经在我的 Apple Silicon (ARM64) 机器上安装了 Python ,但它安装为python3而不是python

The problem is that I have a node.js project with dependencies which need python (and pip).问题是我有一个node.js项目,其依赖项需要 python(和 pip)。 They fail to build because they are unable to find python .他们无法构建,因为他们无法找到python

python3 is on the path at /opt/homebrew/python3 which in turn is a link to python3/opt/homebrew/python3的路径上,它又是一个链接

/opt/homebrew/Cellar/python@3.10/3.10.8/bin/python3

I think I need to create a symbolic link python to /opt/homebrew/python3 , but am unsure which path the use /opt/homebrew/python or /Applications/python or something else.我想我需要创建一个符号链接python/opt/homebrew/python3 ,但我不确定使用哪个路径/opt/homebrew/python/Applications/python或其他东西。

Or would it just be cleaner to create a virtualenv?或者创建一个 virtualenv 会更干净吗?

https://github.com/pyenv/pyenv might be able to solve your issue. https://github.com/pyenv/pyenv或许可以解决您的问题。 Depending on the directory you are in, it will intelligently set your python version.根据您所在的目录,它会智能设置您的 python 版本。

Here's a diagram that explains how python environments work下图解释了 python 环境是如何工作的

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM