Since we introduced pipenv, we will summarize the environment construction method.
I want to create requirements.txt without extra packages, so use the dev option to separate the packages to be imported in the code from the packages installed to build the environment.
It would be very helpful if you could point out any mistakes.
pip install pipenv
Install pipenv in your local environment.
Enter the directory where you want to use the virtual environment
pipenv install --python=3.7.6
Create a virtual environment with. Specify the version you want to use as appropriate.
At the same time, ** Pipfile ** and ** Pipfile.lock ** are created in the current directory.
ls
You can see that the file has been created in.
pipenv install [package]
You can install the package in the virtual environment without entering the virtual environment with. For example
pipenv install numpy
Then you can install numpy.
pipenv install --dev [package]
You can install it as a development package using the --dev option.
Install the package used to build the environment using the dev option, and install it. Packages that are imported in the code will be installed without this option.
pipenv lock -r
A list of packages in the virtual environment (other than those entered with --dev) is displayed with.
pipenv lock -r -d
You can check the package of the development environment with.
pipenv run pip freeze
You can check all the packages included in it.
pipenv lock -r > requirements.txt
You can create requirements.txt in the current directory with
pipenv uninstall [package]
Uninstall the package
pipenv clean
Delete the dependent packages that remain even after uninstalling the package.
[Reference] https://qiita.com/eduidl/items/c0e8256bb3a5a735d19c
pipenv --rm
Delete the virtual environment.
pipenv --venv
Get the path of the virtual environment. It can be used to check if there is a virtual environment.
pipenv shell
Enter the virtual environment.
exit
Get out of the virtual environment
Since jupyter lab and VScode have a mechanism that allows you to select a virtual environment,
switch kernel
You can change the virtual environment by clicking.
Recommended Posts