简体   繁体   中英

macports use python install

Sorry, I'm sure this is a stupid question.

I have successfully installed python 2.6 with macports. How do I use that version of python? The version that shows when I type python in term is python 2.7.

Thanks!

Use the port select command to choose it

  1. List the available pythons to select from:

     port select --list python 
  2. to choose a specific port (eg python26):

     port select python python26 

However python2.6 will also choose the version specific one

You should be on Super User .

Call it from the terminal:

python26 PYTHONFILE.py

One way to find Python on your Mac is to type in the command line:

which python

When I type this, I get:

/usr/bin/python

You can see other pythons there by typing

ls /usr/bin/python*

For example, I see:

/usr/bin/python

/usr/bin/python2.7

/usr/bin/python-config

/usr/bin/python2.7-config

/usr/bin/python2.5

/usr/bin/pythonw

/usr/bin/python2.5-config

/usr/bin/pythonw2.5

/usr/bin/python2.6

/usr/bin/pythonw2.6

/usr/bin/python2.6-config

/usr/bin/pythonw2.7

Then, you can run v2.6 by typing

/usr/bin/python2.6

Or, since /usr/bin/ is probably in your path, just:

python2.6

This isn't exactly MacPorts-specific, sorry.

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