简体   繁体   中英

conda equivalent of pip install

If I have a directory with setup.py , in pip , I can pip install . in the directory to install the package.

What if I am using conda ?

conda install . makes conda to find a package named dot.

conda packages are a different structure than standard python packaging. As a result, the official, recommended and best-practice approach is to use conda to install pip within an activated conda environment, and use that to install standard packages:

conda install pip

NOTE : You want to use conda packages whenever they're available, as they have more features within a conda environment than non- conda packages.

conda install pip will install pip within the currently activated conda environment, and will ensure that it is integrated with conda so that, for example, conda list , will include any packages installed with pip .

NOTE : Commands like conda update will ignore pip installed packages, as it only checks conda channels for available updates, so they still need to be updated using pip . See this Question/Answer discussion:

Does conda update packages from pypi installed using pip install?

NOTE: See @kalefranz comment below regarding conda 4.6 experimental handling of packages.

If you're interested in creating your own conda package(s), take a look at this question/1st answer for a great run-down:

How to install my own python module (package) via conda and watch its changes

If you simply wish to install non- conda packages, using pip is the correct, and expected, way to go.

You can use pip install from within conda environment.

Just activate your environment using:

$ conda activate myenvironment

and use pip install . to install your package in environment's directory.

EDIT: As pointed by Chris Larson in another answert, you should install pip inside the environment using

$ conda install pip

in order to register packages correctly.

If I have a whl file, I can use pip install xxx.whl to install it.

From the documentation , conda install from a local file is also available, but the file should be a tarball file, ie .tar.bz2 files.

conda install /package-path/package-filename.tar.bz2 works. And if I have multiple tarballs, I can tar them to get a .tar file, then conda install /packages-path/packages-filename.tar installs the packages in it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM