Macports select default Python interpreter for executing scripts? [closed]

喜你入骨 提交于 2019-12-21 04:13:14

问题


I used python_select, it seems like it does not change the default python for executing scripts, for instance django-admin.py runserver (without python in front).

How do i change this?


回答1:


There is /usr/bin/python, which is usually earlier in the path (has a higher precedence) than MacPort's binary folder (/opt/local/bin/python). The python_select script changes only /opt/local/bin/python, so you have to make sure there is no other python binary on your path taking precedence over it.

Solution (as root):

mv /usr/bin/python /usr/bin/python.orig
ln -s /opt/local/bin/python /usr/bin/python
port select --set python python26

Make sure you replace python26 in the third line with your intended Python version.

It worked for me a few days ago with MacPort 2.0.0. If you have an older MacPorts library, then you should either upgrade it or use python_select instead of port select --set python.



来源:https://stackoverflow.com/questions/6943812/macports-select-default-python-interpreter-for-executing-scripts

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!