简体   繁体   中英

Python scipy modules can't be imported with macports install

I've just reinstalled OSX Lion and decided to use macports to get an updated python, plus numpy, scipy, matplotlib, ipython, etc. After some fuss everything looks installed correctly in the /opt/ folder, and numpy, matplotlib, and ipython are running correctly, but when I try to import modules in scipy I get a failure that seems to go back to the sparse module:

>>> import scipy.sparse as sparse
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scipy/sparse/__init__.py", line 175, in <module>
from csr import *
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scipy/sparse/csr.py", line 12, in <module>
from sparsetools import csr_tocsc, csr_tobsr, csr_count_blocks, \
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scipy/sparse/sparsetools/__init__.py", line 4, in <module>
from csr import *
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scipy/sparse/sparsetools/csr.py", line 25, in <module>
_csr = swig_import_helper()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scipy/sparse/sparsetools/csr.py", line 21, in swig_import_helper
_mod = imp.load_module('_csr', fp, pathname, description)
ImportError: dlopen(/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scipy/sparse/sparsetools/_csr.so, 2): Symbol not found: ___emutls_get_address
  Referenced from: /opt/local/lib/gcc45/libstdc++.6.dylib
  Expected in: /usr/lib/libSystem.B.dylib
 in /opt/local/lib/gcc45/libstdc++.6.dylib

Import scipy.stats or such things ends up in the same place. I've googled a bunch and tried fixing various PATH variables (in the python interpreter and out), as well as hiding the default python install(s? what's the difference between the one in the main Library and the one in /usr/?) and reinstalling scipy but that's done nothing.

I'm not very familiar or comfortable with this stuff - I was working with the EPD before I wiped and reinstalled, but had run into problems getting new packages to recognize that. I use python for scientific stuff, hence not really understanding its guts! So answers assuming I barely understand what a PATH variable is are much appreciated.

So (a) Is there an easy way to fix whatever is going on above? (b) Should I delete some stuff and start from scratch? (c) Is there a non-painful way to get scipy, numpy, matplotlib, and ipython (plus the things it needs for the qtconsole and the html notebook), AND be able to install new packages in the right place? Should I go back to EPD if possible (their academic email thing failed for me, so I moved on)?

您可以尝试Enthought Python Free发行版 ,它的免费发行版通常很容易安装,并且随附Numpy,Scipy,matplotlib等。

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