简体   繁体   English

macports使用python安装

[英]macports use python install

Sorry, I'm sure this is a stupid question. 抱歉,我确定这是一个愚蠢的问题。

I have successfully installed python 2.6 with macports. 我已经用macports成功安装了python 2.6。 How do I use that version of python? 如何使用该版本的python? The version that shows when I type python in term is python 2.7. 当我用术语输入python时显示的版本是python 2.7。

Thanks! 谢谢!

Use the port select command to choose it 使用端口选择命令选择它

  1. List the available pythons to select from: 列出可用的python以供选择:

     port select --list python 
  2. to choose a specific port (eg python26): 选择特定的端口(例如python26):

     port select python python26 

However python2.6 will also choose the version specific one 但是python2.6也会选择特定于版本的

You should be on Super User . 您应该是超级用户

Call it from the terminal: 从终端调用它:

python26 PYTHONFILE.py python26 PYTHONFILE.py

One way to find Python on your Mac is to type in the command line: 在Mac上查找Python的一种方法是在命令行中键入:

which python 哪个蟒蛇

When I type this, I get: 键入此内容时,我得到:

/usr/bin/python / usr / bin / python

You can see other pythons there by typing 您可以通过键入在此处看到其他python

ls /usr/bin/python* ls / usr / bin / python *

For example, I see: 例如,我看到:

/usr/bin/python / usr / bin / python

/usr/bin/python2.7 /usr/bin/python2.7

/usr/bin/python-config / usr / bin / python-config

/usr/bin/python2.7-config /usr/bin/python2.7-config

/usr/bin/python2.5 /usr/bin/python2.5

/usr/bin/pythonw / usr / bin / pythonw

/usr/bin/python2.5-config /usr/bin/python2.5-config

/usr/bin/pythonw2.5 /usr/bin/pythonw2.5

/usr/bin/python2.6 /usr/bin/python2.6

/usr/bin/pythonw2.6 /usr/bin/pythonw2.6

/usr/bin/python2.6-config /usr/bin/python2.6-config

/usr/bin/pythonw2.7 /usr/bin/pythonw2.7

Then, you can run v2.6 by typing 然后,您可以输入以下命令来运行v2.6

/usr/bin/python2.6 /usr/bin/python2.6

Or, since /usr/bin/ is probably in your path, just: 或者,由于/ usr / bin /可能在您的路径中,因此:

python2.6 python2.6

This isn't exactly MacPorts-specific, sorry. 抱歉,这并非特定于MacPorts。

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

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