【问题标题】:How do I symlink python to the osx default python?如何将 python 符号链接到 osx 默认 python?
【发布时间】:2016-10-08 00:47:36
【问题描述】:

目前我使用conda 来管理我的python 安装,我只安装了python3

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

所以现在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.
>>> 

我想这可能不是一个好主意,brew doctor 也抱怨说

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

那么如何将python指向osx系统默认的python 2.x版本呢?

【问题讨论】:

  • IDK 如果这是最好的方法,但如果 /Users/username/miniconda3/bin/python 是符号链接,删除它可能会起作用。
  • 您是否尝试过修改.bash_profile 中的PATH。我遇到了同样的问题,因为 Anaconda3 安装程序创建了这个符号链接。

标签: python macos path homebrew


【解决方案1】:

用户/您的用户名/

在里面点击:“Shift”+“Command”+“.” (显示隐藏文件)。 有一个文件“.bash-profile” -> 右键 -> textedit .

粘贴:

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

“命令”+“s”。现在你有了一个符号链接。

【讨论】:

    猜你喜欢
    • 2016-05-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-07-26
    • 2018-01-15
    • 2012-09-07
    • 1970-01-01
    相关资源
    最近更新 更多