当我执行pip install statsmodels
时,它会给我ImportError: statsmodels requires patsy. http://patsy.readthedocs.org
,但之后我会运行pip install patsy
并表示它已成功,但正在运行pip install statsmodels
仍然会给我同样的错误
这怎么可能?
$ sudo pip install patsy
Requirement already satisfied (use --upgrade to upgrade): patsy in /Library/Python/2.7/site-packages/patsy-0.3.0-py2.7.egg
Requirement already satisfied (use --upgrade to upgrade): numpy in /Library/Python/2.7/site-packages/numpy-1.8.2-py2.7-macosx-10.9-intel.egg (from patsy)
Cleaning up...
$ sudo pip install statsmodels
Downloading/unpacking statsmodels
Downloading statsmodels-0.5.0.tar.gz (5.5MB): 5.5MB downloaded
Running setup.py (path:/private/tmp/pip_build_root/statsmodels/setup.py) egg_info for package statsmodels
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/private/tmp/pip_build_root/statsmodels/setup.py", line 463, in <module>
check_dependency_versions(min_versions)
File "/private/tmp/pip_build_root/statsmodels/setup.py", line 122, in check_dependency_versions
raise ImportError("statsmodels requires patsy. http://patsy.readthedocs.org")
ImportError: statsmodels requires patsy. http://patsy.readthedocs.org
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/private/tmp/pip_build_root/statsmodels/setup.py", line 463, in <module>
check_dependency_versions(min_versions)
File "/private/tmp/pip_build_root/statsmodels/setup.py", line 122, in check_dependency_versions
raise ImportError("statsmodels requires patsy. http://patsy.readthedocs.org")
ImportError: statsmodels requires patsy. http://patsy.readthedocs.org
----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /private/tmp/pip_build_root/statsmodels
Storing debug log for failure in /Users/Jacob/Library/Logs/pip.log
答案 0 :(得分:6)
错误消息没有告诉您的是six
模块不在那里确实存在问题。
通过import patsy
找到这个并让它失败并告诉我我需要six
。所以我做了pip install six
,现在patsy导入工作了,pip install statsmodels
也是如此。
答案 1 :(得分:1)
对我来说:
$python3 -m pip install --upgrade patsy
$python3 -m pip install statsmodels
工作!
答案 2 :(得分:1)
对于任何仍有问题的人,我强烈推荐此网站: Python libraries。我正在使用Python 3,所以我,
statsmodels‑0.8.0‑cp35‑cp35m‑win_amd64.whl
cd Downloads
)pip install statsmodels‑0.8.0‑cp35‑cp35m‑win_amd64.whl
)答案 3 :(得分:0)
我在Python 3.4中也遇到过这个问题。它使用此链接上的WHL statsmodel文件:https://pypi.python.org/pypi/statsmodels#downloads
下载后我使用:pip3.4安装my_directory \ statsmodels-0.8.0rc1-cp34-none-win_amd64.whl,其中my_directory是我放置WHL文件的位置。