Pipenv和Conda? [英] Pipenv with Conda?

查看:611
本文介绍了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\to\python
....\miniconda2\lib\site-packages\pipenv\_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可执行文件和站点包目录(

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安装了NumPy而不是Pipenv的情况下,您可以看到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?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆