我刚开始使用Rodeo
with Python 3.6.2
。但是statsmodels
在Windows 10下导入时出现错误。下面是脚本:
import pandas as pd
import statsmodels.api as sm
import pylab as pl
import numpy as np
突出显示import statsmodels.api as sm
并单击Run line
时,出现错误:
>>> import statsmodels.api as sm
ImportError: No module named 'statsmodels'
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-3-6030a6549dc0> in <module>()
----> 1 import statsmodels.api as sm
ImportError: No module named 'statsmodels'
然后我下载并安装了它statsmodels
。Github
这是输出pip list
:
C:\Users\Documents\statsmodels-master\statsmodels-master>pip list
DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
Cython (0.26)
numpy (1.13.1)
pandas (0.20.3)
patsy (0.4.1)
pip (9.0.1)
python-dateutil (2.6.1)
pytz (2017.2)
scipy (0.19.1)
setuptools (28.8.0)
six (1.10.0)
statsmodels (0.8.0)
输出显示statsmodels 0.8.0
已安装。但是仍然存在导入错误。似乎Rodeo
很难看到statsmodels
。
更新:
这是print(sys.pth)
in的输出Rodeo
。有一条路径statsmodels
。
>>> print(sys.path)
['', 'C:\\Python36\\Scripts', 'c:\\python36\\lib\\site-packages\\statsmodels-0.8.0-py3.6-win-amd64.egg', 'C:\\Python36', 'C:\\Python36\\python36.zip', 'C:\\Python36\\DLLs', 'C:\\Python36\\lib', 'C:\\Python36\\lib\\site-packages', 'C:\\Python36\\lib\\site-packages\\patsy-0.4.1-py3.6.egg', 'C:\\Python36\\lib\\site-packages\\pandas-0.20.3-py3.6-win-amd64.egg', 'C:\\Python36\\lib\\site-packages\\six-1.10.0-py3.6.egg', 'C:\\Python36\\lib\\site-packages\\pytz-2017.2-py3.6.egg', 'C:\\Python36\\lib\\site-packages\\python_dateutil-2.6.1-py3.6.egg', 'C:\\Python36\\lib\\site-packages\\IPython\\extensions', 'C:\\Users\\JunC\\.ipython']