繁体   English   中英

Pipenv shell 不协调 Python 命令

[英]Pipenv shell doesn't reconize Python command

我开始使用 Python,并且我已经安装了 Python(我正在使用 miniconda)和 Pipenv。 I know both are correctly installed because if I run somehting like python version or pipenv version , I get a correct output, but after I access pipenv shell and try running python to access the python interpreter, it just remains blank. 我什至没有收到错误消息。 就好像它崩溃了一样。 只是为了添加更多信息,如果我在终端中运行python之前也发生过同样的情况,我看到我需要使用winpty python命令,但我创建了一个别名将其重命名为python pipenv shell,它不在这个中运行。

Conda 和 pipenv 是领先的 Python package 管理器,允许您创建虚拟环境并在其中安装第 3 方包。 虚拟环境是 Python 安装,带有定义的包版本,它们应该一起工作以支持您的编程需求。 你的 Python 代码加上你的环境定义将允许其他人在他们的机器上运行你的程序,即使他们有不同的操作系统。

Conda 环境: 如何创建 conda 环境

> conda create --name myenv pandas matplotlib
> conda activate myenv
(myenv) > conda list --explicit > myenv.txt
(myenv) > python

通过以下方式重新创建此环境:

conda env create --file myenv.txt 

Pipenv环境:如何创建 pipvenv 环境

> pipenv install pandas matplotlib
> pipenv shell
(.venv) > python

pipenv install会在您的项目文件夹中自动创建“Pipfile”,用于通过以下方式重新创建此环境:

> pipenv install

使用您的项目,您只能激活一个环境,不能同时激活两个. 您可以 使用 Conda 安装基于 Anaconda Pipenv 的 pipenv 吗? , 但这根本没有任何优势。

However, the big advantage of Anaconda is that they suppose to guaranty maximum consitency for the 'scientific stack' (numpy, pandas, scipy, matplotlib), but you might experience that not all pypi packages are available on anaconda.org, so that you必须将pip install (不是pipenv install )包安装到 conda 环境中,这是可以接受的,只要它不是基本环境。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM