如何在 mac 上重新安装 python,但版本为 3.2(最新)并让所有命令行功能正常工作

发布于 2024-10-21 14:14:45 字数 379 浏览 1 评论 0 原文

我使用以下命令卸载了python:

sudo rm -rf /Library/Frameworks/Python.framework

sudo rm -rf /Applications/Python *

然后删除了这里所有与python相关的东西:

 /usr/local/bin

我刚刚安装了python 3.2,但是终端python不起作用,$>; python 不做任何事情,除了说找不到命令之外

,我卸载了所有 python 东西,因为,使用全局站点包的旧 python 存在问题......所以我认为最好开始干净(我喜欢......之前有5个版本)

I uninstalled python using the following commands:

sudo rm -rf /Library/Frameworks/Python.framework

sudo rm -rf /Applications/Python *

then deleted all python related things in here:

 /usr/local/bin

And I just installed python 3.2, but the terminal python doesn't work, $> python doesn't do anything, other than say command not found

I uninstalled all the python stuff, because, there was a problem with the older pythons using global site-packages... so I figured it would be good to start clean (i had like... 5 versions before)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

撩发小公举 2024-10-28 14:14:45

嗯,不确定我是否真的会删除 Mac 操作系统上安装的东西......抓住你的安装 CD 并恢复默认的 Python :)

然后安装 MacPorts 输入 sudo port install python32,您将在 /opt 中与默认安装相对安全的位置单独安装 Python 3.2。

Hmm not sure I'd really go around deleting things that were installed my Mac OS.... grab your install CD and get the default Python back :)

Then install MacPorts type sudo port install python32 and you'll have a seperate install of Python 3.2 in /opt somewhere safe from the default one.

一个人的旅程 2024-10-28 14:14:45

尝试 ActivePython。它不仅会自动在 /usr/local/bin 中创建符号链接,而且还附带一个名为 pythonselect 可用于设置“活动”Python 版本。

Try ActivePython. Not only does it automatically create symlinks in /usr/local/bin, but also comes with a tool called pythonselect which you can use to set the "active" Python version.

煞人兵器 2024-10-28 14:14:45

您需要弄清楚的第一件事是您当前的安装位置。我问的原因是因为我并排安装了多个版本的 python,尽管每个版本都有不同的名称。 /usr/local/bin/python 只是真正二进制文件的符号链接。

例如,也许您有 /usr/local/bin/python-3.2 而不是 /usr/local/bin/python。一旦您知道它在哪里,您所要做的就是通过以下方式创建指向它的符号链接:

ln -s /usr/local/bin/python-3.2 /usr/local/bin/python

当然,这只是一个示例,您的路径可能会有所不同。此外,您还必须以 root (sudo) 身份运行该命令。

First thing you need to figure out is where your current installation is. The reason I ask is because I have several versions of python installed side-by-side though each with a different name. /usr/local/bin/python is just a sym-link to the real binary file.

For example, maybe you have /usr/local/bin/python-3.2 instead of /usr/local/bin/python. Once you know where it is, all you have to do is create a symbolic link to it via:

ln -s /usr/local/bin/python-3.2 /usr/local/bin/python

That's only an example of course and you're paths might be different. Also you'll have to run that command as root (sudo).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文