我遇到的根本问题是,当我试图在Mac中的Anaconda木星笔记本中调用statsmodels.stats.proportion的statsmodels.stats.proportion属性时,我会得到以下错误:
AttributeError: module 'statsmodels.stats.proportion' has no attribute 'test_proportions_2indep'我认为这是因为Statsmodels没有得到正确的更新。当我调用statsmodels.__version__时,它说我在当前环境中安装了0.11.1,但是文档页面中的版本是0.12.1。
我采取了以下步骤:
! conda update statsmodels -y、! conda update statsmodels=0.12.1 -y和! conda install -c conda-forge statsmodels。最后,我给出了以下命令(! conda install update statsmodels==0.12.1 -y),并在命令行中得到了一个新的错误/响应:
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
PackagesNotFoundError: The following packages are not available from current channels:
- statsmodels==0.12.1
- update
Current channels:
- https://repo.anaconda.com/pkgs/main/osx-64
- https://repo.anaconda.com/pkgs/main/noarch
- https://repo.anaconda.com/pkgs/r/osx-64
- https://repo.anaconda.com/pkgs/r/noarch
To search for alternate channels that may provide the conda package you're
looking for, navigate to
https://anaconda.org
and use the search bar at the top of the page.当然,Statsmodels的版本仍然是0.10.1。
因此: 1.是否需要更新Statsmodels以使用此属性?2.如何更新?
发布于 2020-11-02 03:15:57
过去,当我尝试从基本环境升级软件包时,我与Anaconda有过很多问题。以下是我的建议:
创造你自己的环境。您可以通过Anaconda或命令行这样做,如下所示:
conda create --name newenv现在,您可以使用以下方法激活此环境:
conda activate newenv如果您想查看所有可用的环境:
conda info --envs对我来说,这印的是:
base C:\ProgramData\Anaconda3
myenv C:\Users\james\.conda\envs\myenv
newenv * C:\Users\james\.conda\envs\newenv从*中可以看出,我目前在newenv中。
现在,我可以使用pip来显示我当前安装的statsmodels。
pip show statsmodels对我来说,这说明:
Name: statsmodels
Version: 0.11.0
Summary: Statistical computations and models for Python
Home-page: https://www.statsmodels.org/
Author: None
Author-email: None
License: BSD License
Location: c:\programdata\anaconda3\lib\site-packages
Requires: numpy, scipy, pandas, patsy
Required-by:要升级到最新最好的版本,我只需使用conda update来升级它。
conda update statsmodelspip show statsmodels现在告诉我,我已经安装了0.12.1版本。
我也强烈推荐conda小单。它拥有您在conda中获得舒适所需的所有命令行内容。
https://stackoverflow.com/questions/64639067
复制相似问题