如果安装了多个Python,MacPorts如何知道要为其安装MySQLdb? [英] With multiple Python installs, how does MacPorts know which one to install MySQLdb for?
问题描述
我刚刚通过www.python.org上的安装程序将Leopard上的默认Python 2.5升级到2.6.这样做后,不再找到我已安装的MySQLdb.因此,我尝试通过 port install py-mysql
重新安装它,但成功了,但是MySQLdb仍然不能 import
.因此,然后我尝试使用 python_select python26
python install python26
并成功,但似乎没有优先于python.org安装:
I just upgraded the default Python 2.5 on Leopard to 2.6 via the installer on www.python.org. Upon doing so, the MySQLdb I had installed was no longer found. So I tried reinstalling it via port install py-mysql
, and it succeeded, but MySQLdb was still not import
able. So then I tried to python install python26
with python_select python26
and it succeeded, but it doesn't appear that it is getting precedence over the python.org install:
$ which python
/Library/Frameworks/Python.framework/Versions/2.6/bin/python
当我期望它像/opt/local/bin/python
我的 path
环境是:/Library/Frameworks/Python.framework/Versions/2.6/bin:/usr/local/mysql/bin/:/opt/local/bin:/opt/本地/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/local/mysql/bin:/Users/bsr/bin
无论如何,当我尝试 port install py-mysql
时,它怎么知道在哪里安装Python MySQL库?
Anyway, when I try port install py-mysql
but how does it know where to install the Python MySQL library?
推荐答案
MacPorts
python端口通常遵循以下模式:如果端口名称仅以 py-
开头,它配置为安装到MacPorts python2.4中.同样, py25-
需要python2.5.对于 MacPorts python2.6,你想要这个端口:
The MacPorts
python ports generally follow a pattern: if the port name starts with just py-
, it is configured to install into MacPorts python2.4. Likewise py25-
requires python2.5. For the MacPorts python2.6, you want this port:
sudo port install py26-mysql
这篇关于如果安装了多个Python,MacPorts如何知道要为其安装MySQLdb?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!