简体   繁体   中英

Pipenv shell doesn't reconize Python command

I'm getting started with Python, and I have already installed Python (I'm using miniconda) and 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. I don't even get an error message. It is as if it crashes. Just to add more information, I had the same happen before if I ran python in the terminal, and I saw that I needed to use the winpty python command, but I created an alias to rename it as python , and although it works outside of the pipenv shell, it doesn't run in this one.

Conda and pipenv are the leading Python package managers that allow you to create virtual environements and install 3rd party packages into them. A virtual environement is a Python installation with defined package-versions that are supposed to work together to support your programming needs. Your Python code plus your environment definition will allow others to run your program on their machines, even if they have a different operation system.

Conda environments : How to create a conda environment

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

Recreate this environment via:

conda env create --file myenv.txt 

Pipenv environemnts : How to create a pipvenv environment

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

pipenv install automatically creates 'Pipfile' in your project folder that will be used to recreate this environemnt via:

> pipenv install

With your project you can activate one environment only, not both . You can install pipenv based on Anaconda Pipenv with Conda? , but this has no advantage at all.

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 have to pip install (NOT pipenv install ) packages into a conda environment, which is acceptable, as long as it is not the base environment.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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