You no longer need to use pip
and virtualenv
separately. Use pipenv
instead.
ref:
https://github.com/pypa/pipenv
https://pipenv.kennethreitz.org/en/latest/
Install
$ pip install pipenv
ref:
https://pipenv.kennethreitz.org/en/latest/install/#installing-pipenv
Usage
$ pyenv global 3.7.4
# initialize project virtualenv with a specific Python version
# automatically generate both Pipfile and Pipfile.lock from requirements.txt if it exists
$ pipenv --three
$ cd /path/to/project-contains-Pipfile
$ pipenv install
$ pipenv install pangu
$ pipenv install -r requirements.txt
# install packages to dev-packages
$ pipenv install --dev \
autopep8 \
flake8 \
flake8-bandit \
flake8-blind-except \
flake8-bugbear \
flake8-builtins \
flake8-comprehensions \
flake8-debugger \
flake8-mutable \
flake8-pep3101 \
flake8-print \
flake8-string-format \
ipdb \
jedi \
mypy \
pep8-naming \
ptvsd \
pylint \
pylint-celery \
pylint-common \
pylint-flask \
pytest \
watchdog
# switch your shell environment to project virtualenv
$ pipenv shell
$ exit
# uninstall everything
$ pipenv uninstall --all
# remove project virtualenv
$ pipenv --rm
ref:
https://pipenv.kennethreitz.org/en/latest/install/
Example Pipfile
[[source]]
url = "https://pypi.python.org/simple"
verify_ssl = true
name = "pypi"
[requires]
python_version = "3.7"
[packages]
celery = "==4.2.1"
flask = "==1.0.2"
requests = ">=2.0.0"
[dev-packages]
flake8 = "*"
ipdb = "*"
pylint = "*"
[scripts]
web = "python -m flask run -h 0.0.0.0"
worker = "celery -A app:celery worker --pid= -l info -E --purge"
scheduler = "celery -A app:celery beat -l info --pid="
shell = "flask shell"
ref:
https://pipenv.kennethreitz.org/en/latest/basics/#example-pipfile-pipfile-lock