【问题标题】:How to install Keras tuner for anaconda?如何为 anaconda 安装 Keras 调谐器?
【发布时间】:2019-12-24 13:32:02
【问题描述】:

我已经在我创建的 conda 环境中尝试了这些命令。

sudo pip install -U keras-tuner

sudo pip3 install -U keras-tuner

git clone https://github.com/keras-team/keras-tuner.git
cd keras-tuner
pip install .

我的 jupyter 笔记本仍然显示错误说明:

没有名为 kerastuner 的模块

【问题讨论】:

    标签: python-3.x machine-learning keras anaconda


    【解决方案1】:

    我刚刚安装了它:conda install -n env_name -c conda-forge keras-tuner

    【讨论】:

      【解决方案2】:

      要使用 conda 安装此软件包,请运行以下一个

      conda install -c conda-forge keras-tuner
      conda install -c conda-forge/label/cf202003 keras-tuner
      

      来源:https://anaconda.org/conda-forge/keras-tuner

      【讨论】:

        【解决方案3】:

        如果您发现自己需要 Conda 中的 PyPI 包,那么您应该编写一个 YAML 文件并使用它创建一个新环境。这是在“Using Pip in a Conda Environment”中找到的最佳实践建议。否则,如果您安装 PyPI 包 ad hoc,Conda 会变得相当不稳定。它会是这样的:

        environment.yml

        name: my_keras_env
        channels:
          - conda-forge
          - defaults
        dependencies:
          - python=3.7         # change this to meet your needs
          - ipykernel          # since you're using Jupyter
          - keras       
          - tensorflow>=2.0.0  # this and below are keras-tuner requirements
          - numpy
          - tabulate
          - terminaltables
          - colorama
          - tqdm
          - requests
          - psutil
          - scipy
          - scikit-learn
          - ...                # add any additional packages you require
          - pip
          - pip:
            - keras-tuner
        

        注意keras-tuner 的要求是found in the setup.py file。 然后,创建环境

        conda env create -f environment.yml
        

        请注意,您可以使用 --name|-n 标志为环境提供不同的名称。

        当您需要向 env 添加其他包时,编辑 YAML 定义并重新创建 env。

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 2017-08-08
          • 2017-04-30
          • 1970-01-01
          • 2018-05-10
          • 2020-05-14
          • 1970-01-01
          • 2019-06-09
          相关资源
          最近更新 更多