0

在 Mac OS X Mountain Lion 上,我尝试

import numpy as np
import os
import statsmodels.api as sm

我收到此错误:

    /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python /Users/idf/PycharmProjects/PyAlgoTrade/GoldvsMiners.py
Traceback (most recent call last):
  File "/Users/idf/PycharmProjects/PyAlgoTrade/GoldvsMiners.py", line 9, in <module>
    import statsmodels.api as sm
  File "/Library/Python/2.7/site-packages/statsmodels-0.0.0-py2.7-macosx-10.8-intel.egg/statsmodels/api.py", line 1, in <module>
    import iolib, datasets, tools
ImportError: No module named iolib

如果我添加

import sys
print("=======")
print sys.path
print("=======")

我明白了

=======

['/Users/idf/PycharmProjects/PyAlgoTrade', '/Library/Python/2.7/site-packages/pytz-2013b-py2.7.egg', '/Library/Python/2.7/site-packages/statsmodels-0.0.0-py2.7-macosx-10.8-intel.egg', '/Library/Python/2.7/site-packages/pip-1.4-py2.7.egg', '/Users/idf/PycharmProjects/PyAlgoTrade', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC', '/Library/Python/2.7/site-packages']
=======

我曾尝试在网上搜索,但我被困在这个网上。有任何想法吗?

4

0 回答 0