2

I've started to use python and recently i've bought my first mac. I saw that Mountain Lion comes with their own python versions, despite i've decided to install a new python 2.7.5, and also Django and MySQL-Python. Everything works fine. I've decided to try scipy and following the installed steps suggested by the official site with macports It seemed that macports installed another version 2.7.5 of python. Now if i try to run python in my terminal and import numpy it fails. I saw that when i run python in my terminal, it execute

/Library/Frameworks/Python.framework/Versions/2.7/bin/python

But if I go in

cd /System/Library/Frameworks/Python.framework/Versions/2.7/bin

and run ./python i can import django and numpy modules but not MySQLdb modules.

I'm really confused how I can fix that mess.

I would like to have just one Python version installed in one place with all the modules I need. Or please suggest something to clean that mess, know and have the control to what modules I have, where they are and how to import them! And also control which version of Python I want to run.

Edit 10/27/2013: i've solved following the link suggested in the comment, deleting all versions in /Library/ and all simlinks in /usr/local/bin, after that i changed to the path i wanted the py interpreter in my bash_profile. Actually the problems seems to be created by macports that has installed numpy using the py interpreter installed under /System/, so i changed my default py interpreter to that installed under /System/ and installed the rest of packages i need. Now everything works as i want.

4

1 回答 1

0

就个人而言,我不会乱用 Python 的内置版本。几个月前,当我这样做时,我的 Mac 遇到了一些实际问题。

你可以试试 Canopy。这是一个 Python 开发环境,非常适合编写和执行代码。您可以使用包管理器轻松添加(或删除)您需要的任何包。https://www.enthought.com/products/canopy/

于 2013-10-23T13:52:59.590 回答