Notas de Luis

¡Esta es una revisión vieja del documento!


# Python pipenv

## Instalar pipenv

```bash pip install –user pipenv ```

## Activate/Deactivate Environment

```bash pipenv shell   # Activate exit   # Deactivate ```

## Locate environment

```bash pipenv –venv   # locates for a particular project ```

## Delete environment

```bash pipenv –rm   # This will not remove the Pipfiles ```

## Install/Uninstall/Update Packages

```bash pipenv install flask   # Create virtual environment if necessary pipenv install flask==0.12.1 # Installs specific version pipenv install pytest –dev   # Separate dev packages from production pipenv uninstall flask   # Uninstalls package pipenv uninstall –all   # Uninstalls all packages pipenv uninstall –all-dev   # Uninstalls all dev packages pipenv update package_name   # Update specific package pipenv update   # Updates all packages ```

## Create/Update the lock file

  pipenv lock   # Done usually before pushing the code

## To install from Pipfile

installs from pipfile along with dev pacakges; creates environment if not present; updates packages if version not mentioned

```bash pipenv install –dev ```

doesn’t install dev packages; creates environment if not present; updates packages if version not mentioned

```bash pipenv install   ```

installs from lock file; creates environment if not present; updates packages if version not mentioned

```bash pipenv install –ignore-pipfile   ```

## Install/Export requirements.txt

```bash pipenv install -r requirements.txt   # installs a list of requirements pipenv lock -r > requirements.txt   # export a list of requirements ```

## Create environment with specific python version

```bash pipenv shell –python 3.5   # will use python 3.5 now ```

## Open Third Party Package

opens code in default editor; to open in vscode use environment variable EDITOR=code

```bash pipenv open requests   ```

## Run in Environment without opening Shell

```bash pipenv run   # e.g pipenv run python app.py ```

## Check Security Vulnerabilities

```bash pipenv check ```

## List Packages and their Dependencies

```bash pipenv graph   ```

## to resolve conflicting sub-dependencies use

```bash pipenv graph –reverse ```

computing/coding/python/python_pipenv.1727261406.txt.gz · Última modificación: por 127.0.0.1