問(wèn)題描述
我在 win 10 中將 Anaconda 用于我的 virtualenvs.我正在使用 git-bash .我最近一直在閱讀有關(guān) pipenv 的信息并決定試一試.我在我的基礎(chǔ) conda python 上安裝了 pipenv,它是 python 2.7 的一個(gè)版本,使用:
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
我可以輕松地創(chuàng)建一個(gè) python 環(huán)境使用
I can easily create a python environment using
conda create --name py3 python=3.6
但我試過(guò)了:
$ 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)
這兩個(gè)包可以一起用嗎?
Is it possible to use the 2 packages together?
推薦答案
您可以設(shè)置 Pipenv 以使用 Conda 的 Python 可執(zhí)行文件和站點(diǎn)包目錄 (ref).
You can setup Pipenv to use Conda's Python executable and site packages directory (ref).
pipenv --python=$(conda run which python) --site-packages
您可以檢查您是否確實(shí)在 Pipenv 中使用了您的 Conda 環(huán)境:
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>
通過(guò) Conda 而不是 Pipenv 安裝 NumPy,您可以看到 Pipenv 仍然會(huì)找到 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>
當(dāng)你通過(guò) Pipenv 安裝 NumPy 時(shí),它會(huì)影響 Conda 對(duì)包的安裝.
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>
這篇關(guān)于Pipenv 與 Conda?的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!