About
pipenv is a dependency framework for Python.
Articles Related
Managing
Install pipenv
pip
pip install --user pipenv
PyCharm
Steps
Add dependency
pipenv install package
it will install a Python - virtualenv (Python Environment / venv)
Example
pipenv install requests
Creating a virtualenv for this project…
Pipfile: D:\code\python-gh\Pipfile
Using c:\python37-32\python.exe (3.7.1) to create virtualenv…
Complete
Already using interpreter c:\python37-32\python.exe
Using base prefix 'c:\\python37-32'
New python executable in C:\Users\gerard\.virtualenvs\python-gh-yOsZOOt6\Scripts\python.exe
Installing setuptools, pip, wheel...
done.
Virtualenv location: C:\Users\gerard\.virtualenvs\python-gh-yOsZOOt6
Creating a Pipfile for this project…
Installing requests…
Installation Succeeded
Pipfile.lock not found, creating…
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
Success!
Updated Pipfile.lock (444a6d)!
Installing dependencies from Pipfile.lock (444a6d)…
================================ 5/5 - 00:00:01
Pipfile
The created Pipfile (configuration). The Pipfile is used to track which dependencies your project needs.
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true
[[source]]
url = "http://hostname/repository/pypi-all/simple/"
name = "pypi-aap"
verify_ssl = false
[dev-packages]
[packages]
requests = "*"
[requires]
python_version = "3.7"
where:
- source define a repository
Activate / use the virtual env
- to activate the virtual env
To activate this project's virtualenv, run pipenv shell.
Alternatively, run a command inside the virtualenv with pipenv run.
Example:
- pipenv shell
pipenv shell
Launching subshell in virtual environment…
Microsoft Windows [Version 10.0.16299.726]
(c) 2017 Microsoft Corporation. All rights reserved.
(python-gh-yOsZOOt6) d:\code\python-gh>
- pipenv run
pipenv run python main.py