简体   繁体   English

如何将python符号链接到osx默认python?

[英]How do I symlink python to the osx default python?

Currently I use conda to manage my python installation, and I only installed python3 . 目前,我使用conda来管理python的安装,而我仅安装了python3

$ which python
/Users/username/miniconda3/bin/python
$ which python3
/Users/username/miniconda3/bin/python3

So now both python and python3 point to the same target: 所以现在pythonpython3指向同一个目标:

$ python
Python 3.5.1 |Continuum Analytics, Inc.| (default, Dec  7 2015, 11:24:55) 
[GCC 4.2.1 (Apple Inc. build 5577)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> 
$ python3
Python 3.5.1 |Continuum Analytics, Inc.| (default, Dec  7 2015, 11:24:55) 
[GCC 4.2.1 (Apple Inc. build 5577)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> 

I imagine this is probably not a very good idea and brew doctor also complained that 我想这可能不是一个好主意, brew doctor也抱怨

Warning: python is symlinked to python3
This will confuse build scripts and in general lead to subtle breakage.

So how can I point python to the osx system default python 2.x version? 那么如何将python指向osx系统默认的python 2.x版本呢?

Users/your_username/ 用户/ your_username /

Inside of it click: "Shift" + "Command" + "." 在其中单击:“ Shift” +“ Command” +“。” (Show hidden files). (显示隐藏文件)。 There is a file ".bash-profile" -> right click -> textedit . 有一个文件“ .bash-profile”->右键单击-> textedit。

Paste: 糊:

export PATH=/usr/local/bin:/usr/local/sbin:~/bin:$PATH 

"Command" + "s". “命令” +“ s”。 Now you have a symlink. 现在您有了一个符号链接。

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

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