简体   繁体   中英

Used MacPorts version of gcc and MacPorts version of python

I am installing theano on Mavericks using macports. One of the installation step is to use macport version of python and gcc. I am not sure where is the path of the macport python.

sudo port select python python27
which python 
"/Library/Frameworks/Python.framework/Versions/2.7/bin/python"

usually macport save package on under /opt/local/bin/

in the .bash_profile file I have these lines

# Setting PATH for Python 2.7

    # The orginal version is saved in .bash_profile.pysave
    PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}"
    export PATH

and under /opt/local/bin/ , there is binary file python2.7

So what it the version corresponding to Macport?

for gcc I have the same confusion:

Available versions for gcc: sudo port select gcc mp-gcc47 mp-gcc49 (active) mp-gcc5 none and

  which gcc
  "/usr/bin/gcc"

and under /opt/local/bin I have a binary file gcc

Any explanation?

MacPorts adds export PATH="/opt/local/bin:/opt/local/sbin:$PATH" to the end of ~/.profile , so that /opt/local/bin is searched first.

Clearly, if you override this by prepending for instance /Library/Frameworks/Python.framework/Versions/2.7/bin to the PATH , then python will be found in that directory first. You can run which -a python by the way to show all available python executables.

So, one way to "fix" this issue is to move the path setting for python into ~/.profile above the entry for MacPorts -- or to simply comment it out.

I assume there is some similar path issue with gcc .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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