TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Show HN: How to Install Python on a Mac

6 点作者 DanielKehoe大约 1 年前
I recently began using Python for AI projects and found Rye, which is an all-in-one tool that replaces Pyenv, Pip, and Venv, for a more project-centered approach to Python development (like Ruby or JavaScript or Rust). As someone who habitually writes tutorials for beginners, I wrote a series of articles for my mac.install.guide site advocating setting up Python projects using Rye.<p>Am I leading beginners down the wrong path by suggesting Rye for Python tooling?<p>Beginners often encounter READMEs and tutorials that show `pip install something` as a first step. That led me to the error &quot;Command not found: pip&quot; [0] (so I wrote about that). Solving that led to the error &quot;Command not found: python&quot; [1] and I first tried the system Python installed with XCode Command Line Tools and then &quot;brew install python&quot; [2]. That led me to &quot;Error: externally-managed-environment&quot; [3] which is a recent safeguard to encourage Python users to use environment managers to avoid dependency conflicts from globally-installed packages. At that point, I realized that there are two different use cases for using Python, either standalone tools and applications, where it&#x27;s best to &quot;install Pipx&quot; [4], or programming with Python, including installing Python packages, where there&#x27;s need for a version manager, a package manager, and an environment manager. There&#x27;s no built-in version manager (for that, you will &quot;install pyenv&quot; [5]) but Pip and Venv are a built-in package manager and environment manager, once you have Python installed. As a guide, I wrote about &quot;Mac Python&quot; [6] and how to &quot;Update Python&quot; [7].<p>This diagram [8] helped me understand which Python tools are used for version management, package management, and environment management. That&#x27;s where I found Rye, an all-in-one tool that eliminates the need for Pyenv, Pip, Venv, and other tools. So I wrote about how to &quot;install Python with Rye&quot; [9] and how to &quot;Use Rye&quot; [10].<p>These are the articles that were most helpful in showing how to set up a Python development environment:<p>- <a href="https:&#x2F;&#x2F;blog.viraptor.info&#x2F;post&#x2F;python-dependency-management-difficulty-is-an-unhelpful-meme" rel="nofollow">https:&#x2F;&#x2F;blog.viraptor.info&#x2F;post&#x2F;python-dependency-management...</a><p>- <a href="https:&#x2F;&#x2F;justinmayer.com&#x2F;posts&#x2F;homebrew-python-is-not-for-you&#x2F;" rel="nofollow">https:&#x2F;&#x2F;justinmayer.com&#x2F;posts&#x2F;homebrew-python-is-not-for-you...</a><p>- <a href="https:&#x2F;&#x2F;blog.glyph.im&#x2F;2023&#x2F;08&#x2F;get-your-mac-python-from-python-dot-org.html" rel="nofollow">https:&#x2F;&#x2F;blog.glyph.im&#x2F;2023&#x2F;08&#x2F;get-your-mac-python-from-pytho...</a><p>For beginners, I feel Rye is a better choice (as a single tool) than a grab bag of multiple tools, but I heard there is some resistance to Rye in the Python community, as it&#x27;s written in Rust and other people have already tried to improve the Python developer experience without achieving success.<p>Others have suggested asdf or mise (good choices for managing multiple languages), Docker (appropriate for collaboration on a complex project but overkill for simple, one-developer projects), and Nix (a lot to learn).<p>To wrap it all up, I wrote a freeCodeCamp article, &quot;How to Install Python on a Mac&quot; [11]. I&#x27;m sharing the links here for comments and feedback from those more experienced than I.<p>[0] &quot;Command not found: pip&quot; (<a href="https:&#x2F;&#x2F;mac.install.guide&#x2F;python&#x2F;command-not-found-pip" rel="nofollow">https:&#x2F;&#x2F;mac.install.guide&#x2F;python&#x2F;command-not-found-pip</a>)<p>[1] &quot;Command not found: python&quot; (<a href="https:&#x2F;&#x2F;mac.install.guide&#x2F;python&#x2F;command-not-found-python" rel="nofollow">https:&#x2F;&#x2F;mac.install.guide&#x2F;python&#x2F;command-not-found-python</a>)<p>[2] &quot;brew install python&quot; (<a href="https:&#x2F;&#x2F;mac.install.guide&#x2F;python&#x2F;brew" rel="nofollow">https:&#x2F;&#x2F;mac.install.guide&#x2F;python&#x2F;brew</a>)<p>[3] &quot;Error: externally-managed-environment&quot; (<a href="https:&#x2F;&#x2F;mac.install.guide&#x2F;python&#x2F;externally-managed-environment" rel="nofollow">https:&#x2F;&#x2F;mac.install.guide&#x2F;python&#x2F;externally-managed-environm...</a>)<p>[4] &quot;install Pipx&quot; (<a href="https:&#x2F;&#x2F;mac.install.guide&#x2F;python&#x2F;pipx" rel="nofollow">https:&#x2F;&#x2F;mac.install.guide&#x2F;python&#x2F;pipx</a>)<p>[5] &quot;install pyenv&quot; (<a href="https:&#x2F;&#x2F;mac.install.guide&#x2F;python&#x2F;install-pyenv" rel="nofollow">https:&#x2F;&#x2F;mac.install.guide&#x2F;python&#x2F;install-pyenv</a>)<p>[6] &quot;Mac Python&quot; (<a href="https:&#x2F;&#x2F;mac.install.guide&#x2F;python&#x2F;" rel="nofollow">https:&#x2F;&#x2F;mac.install.guide&#x2F;python&#x2F;</a>)<p>[7] &quot;Update Python&quot; (<a href="https:&#x2F;&#x2F;mac.install.guide&#x2F;python&#x2F;update" rel="nofollow">https:&#x2F;&#x2F;mac.install.guide&#x2F;python&#x2F;update</a>)<p>[8] diagram <a href="https:&#x2F;&#x2F;alpopkes.com&#x2F;posts&#x2F;python&#x2F;figures&#x2F;venn_diagram.png" rel="nofollow">https:&#x2F;&#x2F;alpopkes.com&#x2F;posts&#x2F;python&#x2F;figures&#x2F;venn_diagram.png</a><p>[9] &quot;install Python with Rye&quot; (<a href="https:&#x2F;&#x2F;mac.install.guide&#x2F;python&#x2F;install" rel="nofollow">https:&#x2F;&#x2F;mac.install.guide&#x2F;python&#x2F;install</a>)<p>[10] &quot;Use Rye&quot; (<a href="https:&#x2F;&#x2F;mac.install.guide&#x2F;python&#x2F;use-rye" rel="nofollow">https:&#x2F;&#x2F;mac.install.guide&#x2F;python&#x2F;use-rye</a>)<p>[11] &quot;How to Install Python on a Mac&quot; (<a href="https:&#x2F;&#x2F;www.freecodecamp.org&#x2F;news&#x2F;how-to-install-python-on-a-mac&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.freecodecamp.org&#x2F;news&#x2F;how-to-install-python-on-a...</a>)

4 条评论

BiteCode_dev12 个月前
I&#x27;ve been repeating again and again that everywhere, but the sweet spot for beginners is to stick to the boostrapping method that will lead to the least possible modes of failure.<p>Because I don&#x27;t want to repeat it every time, I eventually wrote everything down, so know I can just link to it:<p>For installing Python: &quot;Installing and running Python: the bare minimum you can get away with&quot;<p><a href="https:&#x2F;&#x2F;www.bitecode.dev&#x2F;p&#x2F;installing-python-the-bare-minimum" rel="nofollow">https:&#x2F;&#x2F;www.bitecode.dev&#x2F;p&#x2F;installing-python-the-bare-minimu...</a><p>To manage deps: &quot;Back to basics with pip and venv&quot;:<p><a href="https:&#x2F;&#x2F;www.bitecode.dev&#x2F;p&#x2F;back-to-basics-with-pip-and-venv" rel="nofollow">https:&#x2F;&#x2F;www.bitecode.dev&#x2F;p&#x2F;back-to-basics-with-pip-and-venv</a><p>And how I justify those very steps: &quot;Why not tell people to &quot;simply&quot; use pyenv, poetry, pipx or anaconda&quot;.<p><a href="https:&#x2F;&#x2F;www.bitecode.dev&#x2F;p&#x2F;why-not-tell-people-to-simply-use" rel="nofollow">https:&#x2F;&#x2F;www.bitecode.dev&#x2F;p&#x2F;why-not-tell-people-to-simply-use</a><p>At this point it kinda feels like spamming, but honestly, there is too much noise out there, and those points don&#x27;t come across enough. Especially since most dev are either too little or too much experienced to be helpful.
pvg12 个月前
Show HN is for things you&#x27;ve made other people can try - that excludes reading material like tutorials, blog posts, etc - take a look at <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;showhn.html">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;showhn.html</a>
评论 #40362427 未加载
odie553312 个月前
pyenv + pip are tried and trusted. I would expect every tutorial they encounter will use them. So they&#x27;re worth learning for that.<p>Rye is a great tool, but my issue with it is barely anyone uses it, and no tutorials or guides are going to use it. So when you read a README to install a package, you&#x27;re going to see pip commands and have to figure things out yourself.
评论 #40362440 未加载
smcleod大约 1 年前
brew install pyenv &amp;&amp; pyenv install 3.12
评论 #40351149 未加载