我正在尝试运行一个需要NumPy,SciPy和Pandas才能运行的朴素贝叶斯脚本。为了避免在Mac 10.7上与python的多个副本混淆 - 并且因为我无法弄清楚如何,真的 - 我做了一个virtualenv并在那里安装了NumPy和SciPy,在运行后检查
$ python
>>> import numpy
>>> import scipy
一切正常。现在,我在我的文件目录中,运行python nb_predict.py
给了我一堆错误。
最初,我文件顶部的python编译器的路径是
#!/usr/local/bin/python
但是因为在安装虚拟环境中的所有内容之后我不知道它是否已经改变了,所以我尝试过:
#!/Users/myusername/.virtualenvs/scipy/bin/python
它仍然不起作用。我也使脚本可执行。
请,任何帮助将不胜感激!
这就是我得到的错误:
Traceback (most recent call last):
File "nb_predict.py", line 3, in <module>
from sklearn.naive_bayes import MultinomialNB
File "/Users/myusername/.virtualenvs/scipy/lib/python2.7/site-packages/scikit_learn-0.15_git-py2.7-macosx-10.9-intel.egg/sklearn/naive_bayes.py", line 25, in <module>
from .preprocessing import binarize
File "/Users/myusername/.virtualenvs/scipy/lib/python2.7/site-packages/scikit_learn-0.15_git-py2.7-macosx-10.9-intel.egg/sklearn/preprocessing/__init__.py", line 22, in <module>
from .imputation import Imputer
File "/Users/myusername/.virtualenvs/scipy/lib/python2.7/site-packages/scikit_learn-0.15_git-py2.7-macosx-10.9-intel.egg/sklearn/preprocessing/imputation.py", line 10, in <module>
from scipy import stats
File "/Users/myusername/.virtualenvs/scipy/lib/python2.7/site-packages/scipy-0.14.0.dev_572aaf0-py2.7-macosx-10.9-intel.egg/scipy/stats/__init__.py", line 332, in <module> from .stats import *
File "/Users/myusername/.virtualenvs/scipy/lib/python2.7/site-packages/scipy-0.14.0.dev_572aaf0-py2.7-macosx-10.9-intel.egg/scipy/stats/stats.py", line 181, in <module>
import scipy.special as special
File "/Users/myusername/.virtualenvs/scipy/lib/python2.7/site-packages/scipy-0.14.0.dev_572aaf0-py2.7-macosx-10.9-intel.egg/scipy/special/__init__.py", line 532, in <module>
from ._ufuncs import *
ImportError: dlopen(/Users/myusername/.virtualenvs/scipy/lib/python2.7/site-packages/scipy-0.14.0.dev_572aaf0-py2.7-macosx-10.9-intel.egg/scipy/special/_ufuncs.so, 2): Symbol not found: ___sincos_stret
Referenced from: /Users/myusername/.virtualenvs/scipy/lib/python2.7/site-packages/scipy-0.14.0.dev_572aaf0-py2.7-macosx-10.9-intel.egg/scipy/special/_ufuncs.so
Expected in: /usr/lib/libSystem.B.dylib
in /Users/myusername/.virtualenvs/scipy/lib/python2.7/site-packages/scipy-0.14.0.dev_572aaf0-py2.7-macosx-10.9-intel.egg/scipy/special/_ufuncs.so