从Anaconda的tar.gz安装包

时间:2018-03-16 11:33:47

标签: python python-3.x anaconda conda

我有* .tar.gz文件以及如何在conda虚拟环境中安装该软件包?

我尝试了以下内容:

$ source activate env01
(env01)$ conda install /installers/anaconda/cassandra-driver-3.11.0.tar.gz
Solving environment: failed

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

  - cassandra-driver-3.11.0.tar.gz

Current channels:
...

如果我使用pip install,它不会存储在环境目录中。见下文:

(env01)$ pip install /installers/anaconda/cassandra-driver-3.11.0.tar.gz
Processing /installers/anaconda/cassandra-driver-3.11.0.tar.gz
Requirement already satisfied: six>=1.9 in /dataplatform/software/anaconda/lib/python3.6/site-packages (from cassandra-driver==3.11.0)
Building wheels for collected packages: cassandra-driver
  Running setup.py bdist_wheel for cassandra-driver ... done
  Stored in directory: /home/linknet/.cache/pip/wheels/e9/ff/17/ebfd2f04dfac5206db48c1520c6f669ec225ddc2c192aada17
Successfully built cassandra-driver
Installing collected packages: cassandra-driver
Successfully installed cassandra-driver-3.11.0

我的conda env01目录是:/ dataplatform / software / anaconda / envs / env01

1 个答案:

答案 0 :(得分:0)

我通过从base克隆conda env来管理它并安装包。

$ conda create -n env01 --clone base
Source:      /dataplatform/software/anaconda
Destination: /dataplatform/software/anaconda/envs/env01
The following packages cannot be cloned out of the root environment:
 - conda-4.4.10-py36_0
 - conda-build-3.4.1-py36_0
 - conda-env-2.6.0-h36134e3_1
Packages: 238
Files: 1
Preparing transaction: done
Verifying transaction: done
Executing transaction: done

(env01)$ conda install /installers/anaconda/cassandra-driver-3.11.0py36_1.tar.bz2
Preparing transaction: done
Verifying transaction: done
Executing transaction: done

现在我可以在不连接互联网的情况下安装软件包。