use*_*629 11 python git-bash anaconda pipenv
我在胜利10中使用Anaconda作为我的演奏.我正在使用git-bash.我最近一直在阅读有关pipenv的内容,并决定尝试一下.我在我的基本conda python上安装了pipenv,它是python 2.7的一个版本,使用:
pip install pipenv
Run Code Online (Sandbox Code Playgroud)
我可以轻松地创建一个python环境
conda create --name py3 python=3.6
Run Code Online (Sandbox Code Playgroud)
但我试过了:
$ pipenv install --three
Run Code Online (Sandbox Code Playgroud)
这给了:
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)
Run Code Online (Sandbox Code Playgroud)
是否可以将2个包装一起使用?
您可以在使用python 3初始化的conda环境中安装pipenv.
$ conda create -n pipenv-test python=3
$ source activate pipenv-test
(pipenv-test)$ pipenv install --python=/home/.../miniconda3/envs/pipenv-test/bin/python
Creating a virtualenv for this project…
Using /home/.../miniconda3/envs/pipenv-test/bin/python (3.6.5) to create virtualenv…
?Already using interpreter /home/.../miniconda3/envs/pipenv-test/bin/python
Using base prefix '/home/.../miniconda3/envs/pipenv-test'
New python executable in /home/.../.local/share/virtualenvs/wispy-j1ojliDY/bin/python
Installing setuptools, pip, wheel...done.
Virtualenv location: /home/.../.local/share/virtualenvs/wispy-j1ojliDY
Creating a Pipfile for this project…
Pipfile.lock not found, creating…
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
Updated Pipfile.lock (ca72e7)!
Installing dependencies from Pipfile.lock (ca72e7)…
???????????????????????????????? 0/0 — 00:00:00
To activate this project's virtualenv, run the following:
$ pipenv shell
Run Code Online (Sandbox Code Playgroud)
这似乎对我有用,但我没有广泛测试它.另外,我的基本conda python是3.6,我使用的是Ubuntu 16.04.我很想知道这是否仍然给你带来麻烦.
您可以将Pipenv设置为使用Conda的Python可执行文件和站点包目录(ref)。
pipenv --python=$(conda run which python) --site-packages
Run Code Online (Sandbox Code Playgroud)
您可以检查是否确实在Pipenv中使用了Conda环境:
pipenv run python
>>> import sys
>>> sys.executable, sys.path
# <directories under your Conda environment>
Run Code Online (Sandbox Code Playgroud)
在通过Conda安装了NumPy而不是Pipenv的情况下,您可以看到Pipenv仍然可以找到NumPy。
conda install numpy
pipenv run python
>>> import numpy as np
>>> np.__file__
# <path under your Conda environment>
Run Code Online (Sandbox Code Playgroud)
当您通过Pipenv安装NumPy时,它将掩盖Conda对该软件包的安装。
pipenv install numpy
pipenv run python
>>> import numpy as np
>>> np.__file__
# <path under your Pipenv environment>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
14106 次 |
| 最近记录: |