Pipenv 与 Conda?

Pipenv with Conda?(Pipenv 与 Conda?)
本文介绍了Pipenv 与 Conda?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我在 win 10 中将 Anaconda 用于我的 virtualenvs.我正在使用 git-bash .我最近一直在阅读有关 pipenv 的信息并决定试一试.我在我的基础 conda python 上安装了 pipenv,它是 python 2.7 的一个版本,使用:

I'm using Anaconda for my virtualenvs in win 10. I'm using git-bash .I've been reading about pipenv recently and decided to give it a try. I installed pipenv on my base conda python which is a version of python 2.7 using :

pip install pipenv

我可以轻松地创建一个 python 环境使用

I can easily create a python environment using

conda create --name py3 python=3.6

但我试过了:

$ pipenv install --three

给了:

Warning: Python 3 was not found on your system…
You can specify specific versions of Python with:
  $ pipenv --python path	opython
....miniconda2libsite-packagespipenv\_compat.py:86: ResourceWarning: Implicitly cleaning up <TemporaryDirectory 'c:\users\......\appdata\local\temp\pipenv-4_fzvq-requi
rements'>
  warnings.warn(warn_message, ResourceWarning)

这两个包可以一起用吗?

Is it possible to use the 2 packages together?

推荐答案

您可以设置 Pipenv 以使用 Conda 的 Python 可执行文件和站点包目录 (ref).

You can setup Pipenv to use Conda's Python executable and site packages directory (ref).

pipenv --python=$(conda run which python) --site-packages

您可以检查您是否确实在 Pipenv 中使用了您的 Conda 环境:

You can check if you are indeed using your Conda environment in Pipenv:

pipenv run python
>>> import sys
>>> sys.executable, sys.path
# <directories under your Conda environment>

通过 Conda 而不是 Pipenv 安装 NumPy,您可以看到 Pipenv 仍然会找到 NumPy.

With NumPy installed through Conda, but not Pipenv, you can see that Pipenv will still find NumPy.

conda install numpy
pipenv run python
>>> import numpy as np
>>> np.__file__
# <path under your Conda environment>

当你通过 Pipenv 安装 NumPy 时,它会影响 Conda 对包的安装.

When you install NumPy through Pipenv, it will shadow Conda's installation of the the package.

pipenv install numpy
pipenv run python
>>> import numpy as np
>>> np.__file__
# <path under your Pipenv environment>

这篇关于Pipenv 与 Conda?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

groupby multiple coords along a single dimension in xarray(在xarray中按单个维度的多个坐标分组)
Group by and Sum in Pandas without losing columns(Pandas中的GROUP BY AND SUM不丢失列)
Group by + New Column + Grab value former row based on conditionals(GROUP BY+新列+基于条件的前一行抓取值)
Groupby and interpolate in Pandas(PANDA中的Groupby算法和插值算法)
Pandas - Group Rows based on a column and replace NaN with non-null values(PANAS-基于列对行进行分组,并将NaN替换为非空值)
Grouping pandas DataFrame by 10 minute intervals(按10分钟间隔对 pandas 数据帧进行分组)