简体   繁体   中英

Trouble installing scipy despite having python2.7 and numpy installed already

I'm having trouble installing scipy via the binaries provided at http://sourceforge.net/projects/scipy/files/scipy/

Double clicking on the mpkg file after mounting the dmg installer gives the following error: "scipy 0.13.0 can't be installed on this disk. scipy requires System Python 2.7 to install"

However, I already have python 2.7 and numpy installed. The python 2.7 came default with OSX Lion, so I assume it is System Python. With other python modules, one normally can download the binary then run python setup.py install

Is there a way to cd through the mpkg file and locate a setup.py? Any advice install via this dmg installer?

I know there are other ways to manage python modules, like port and brew. However, I already installed a bunch of packages through setup.py, and I couldn't figure out how to get port to recognize those packages (for example, it will try to reinstall python and numpy via port)

Thanks!

If you have Mavericks and XCode 5, then you'll have to install Command Line Tools manually from the Apple Developer Site. I found this helpful post

You've got a few misconceptions here.

With other python modules, one normally can download the binary then run python setup.py install

No, that's what you do with source packages.

Is there a way to cd through the mpkg file and locate a setup.py?

No. What's inside an mpkg are pkg files. Which are filled with xar archives filled with cpio archives. Inside there is the built version of SciPy—that is, the files that setup.py would have copied to your site-packages if you'd run it—not the source package.

But you can download the source package yourself.

Or, better, let pip (or easy_install , but pip is better) download and run the setup.py for you.

Any advice install via this dmg installer?

If it won't work, my advice would be to not use it, and instead install with pip .

This blog post explains it, but I'll give you the details relevant to you below.

I know there are other ways to manage python modules, like port and brew. However, I already installed a bunch of packages through setup.py, and I couldn't figure out how to get port to recognize those packages.

You can't. MacPorts will not touch your system Python; it builds its own separate Python 2.7, with a completely independent site-packages directory and everything else. You would have to reinstall everything for this second Python 2.7. And deal with the confusion of having two Python 2.7 installations on the same machine.

Don't do that unless you absolutely have to.

In fact, if you want to use Homebrew for anything (and you do, see below), uninstall MacPorts, unless you really need it for something.


So, here are the steps:

  • Uninstall MacPorts.
  • I assume you already have Xcode and its Command Line Tools.
  • I assume you already have Homebrew.
  • Install a Fortran compiler with brew install gfortran .
  • Lion's Python 2.7 comes with easy_install , but not pip . So sudo easy_install pip to fix that. While you're at it, I'd suggest sudo easy_install readline , because you'll want that for ipython, and it won't work right with pip.
  • Apple's pre-installed NumPy has to be upgraded, and rebuilt with Fortran support, to make SciPy work. Fix that with sudo pip install --upgrade --force-reinstall numpy .
  • If you want ipython, pandas, etc. sudo pip install each of them as well.

In case you're considering upgrading soon, the exact same steps worked for me with OS X 10.9.0, except for some extra work to get the Xcode 5 command line tools set up.

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