How to install specific awscli version in conda en

2019-08-30 19:14发布

问题:

I am trying to install a specific version of awscli within my conda environment (running python 3.6). I have tried adding conda-forge to my current channels, as suggested in another post.

When I run the command conda install -p /Users/myname/anaconda3/envs/py36 awscli==1.11.156 -y

It errors with this message:

Solving environment: failed

PackagesNotFoundError: The following packages are not available from current channels:

  - awscli==1.11.156

Current channels:

  - https://repo.continuum.io/pkgs/main/osx-64
  - https://repo.continuum.io/pkgs/main/noarch
  - https://repo.continuum.io/pkgs/free/osx-64
  - https://repo.continuum.io/pkgs/free/noarch
  - https://repo.continuum.io/pkgs/r/osx-64
  - https://repo.continuum.io/pkgs/r/noarch
  - https://repo.continuum.io/pkgs/pro/osx-64
  - https://repo.continuum.io/pkgs/pro/noarch
  - https://conda.anaconda.org/conda-forge/osx-64
  - https://conda.anaconda.org/conda-forge/noarch

回答1:

Quoting from conda miths and misconceptions by Jake VanderPlas:

If all you are doing is installing Python packages within an isolated environment, conda and pip+virtualenv are mostly interchangeable, modulo some difference in dependency handling and package availability. By isolated environment I mean a conda-env or virtualenv, in which you can install packages without modifying your system Python installation.

You can try to activate your virtual environment and just install it using any of the standard methods. Supposing you have created a conda virtual environment named py36:

$ source activate py36

Or on Windows

> activate py36

Then you just use any of the standard install methods, for example:

$ pip install awscli==1.11.156

$ easy_install https://github.com/aws/aws-cli/archive/1.11.156.tar.gz

The downside is that conda is not managing dependencies for packages installed using pip but in most cases it is OK.