安装patsy,仍然无法安装statsmodels

时间:2014-08-19 15:25:52

标签: python pip statsmodels

当我执行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

4 个答案:

答案 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,所以我,

  1. 下载名为statsmodels‑0.8.0‑cp35‑cp35m‑win_amd64.whl
  2. 的文件
  3. 打开Windows命令提示符
  4. 访问我的下载目录(cd Downloads
  5. 然后使用pip(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文件的位置。