Conda: installing local development package into single conda environment

后端 未结 4 1440
醉梦人生
醉梦人生 2021-02-07 07:42

If I were using a virtualenv, I would activate my project\'s virtual environment then install the package I am developing in develop mode. Something like the following:

相关标签:
4条回答
  • 2021-02-07 08:10

    Activate the environment int which the package is to be installed

    conda activate [environment]
    

    Install the package

    conda install [package]
    
    0 讨论(0)
  • 2021-02-07 08:12

    try this, specify the virtual environment when installing a python package:

    conda install -n superbad fnawesome  
    
    0 讨论(0)
  • 2021-02-07 08:34

    Okay, I figured out the issue behind the question.

    If you create a conda environment, make sure to include pip and ipython. Otherwise, it will not setup the path to point to environment specific versions of these utilities.

    so:

    conda create -n superbad scikit-learn
    source activate superbad
    pip install -e fnawesome  # (installs in default env b/c pip is global pip)
    ipython  # runs global ipython with access to global site packages
    python # runs the environment's python with no access to fnawesome
    

    this works as expected:

    conda create -n superbad scikit-learn pip ipython
    source activate superbad
    pip install -e fnawesome  # installing into superbad site packages
    ipython  # runs superbad ipython
    python  # runs the environment's python with access to fnawesome
    source deactivate
    ipython # no access to fnawesome
    
    0 讨论(0)
  • 2021-02-07 08:35

    You can configure a list of default packages that will be installed into any conda environment automatically

    conda config --add create_default_packages pip --add create_default_packages ipython
    

    will make it so that conda create will always include pip and ipython in new environments (this command is the same as adding

    create_default_packages:
      - ipython
      - pip
    

    to your .condarc file).

    To create an environment without these, use conda create --no-default-packages.

    0 讨论(0)
提交回复
热议问题