简体   繁体   English

Mac上的多个版本的Python

[英]Multiple versions of Python on a Mac

I have installed multiple versions of Python. 我已经安装了多个版本的Python。 Currently when I do which Python - I believe it still points to the default version of the Python and not to the one that's installed by python2.7. 目前,当我使用哪个Python时-我相信它仍然指向Python的默认版本,而不是python2.7安装的版本。

When I try python2.7 it shows a different location of python2.7 当我尝试python2.7时,它显示了python2.7的不同位置

PMs-MBP:~ prem$ which python
/usr/local/bin/python
PMs-MBP:~ prem$ which python python2.7
/usr/local/bin/python
/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7

What should I change to point the default version (Python) to homebrew version? 我应该怎么做才能将默认版本(Python)指向自制版本?

I tried to link using the below command but get the below error: 我尝试使用以下命令进行链接,但出现以下错误:

PMs-MBP:~ prem$ brew link python2.7
Error: No such keg: /usr/local/Cellar/python2.7

我在Linux中有一个类似的问题,我只是卸载python27并保留了python34。

Use brew install python2 to link and install Python2. 使用brew install python2链接和安装Python2。 Then /usr/local/bin/python and /usr/local/bin/python2.7 will be the Homebrew installed version. 然后/usr/local/bin/python/usr/local/bin/python2.7将是Homebrew的安装版本。

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

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