Overview
Il semble bon de combiner pyenv et pipenv
.
$pyenv versions (python version check)
$pyenv install 3.7.0 (install the version signified in the project)
$pyenv local 3.7.0 (set and fix python version in the project)
$pip install pipenv (if pipenv is not installed yet)
$pipenv --python 3.7.0 (create virtual env with python 3.7.0)
$pipenv shell (go into the virtual env)
$pipenv install some_package (even in the virtual env shell, use pipenv install, not pip install)
#Développé ici
$exit (go out of virtual env)
After you pip install some packages in the project, notify that to other members who are working on other branches. This avoids the conflict of package versions when these branches are merged.
Chacun est expliqué en détail ci-dessous.
# If you are the person who makes Pipfiles,,, in the project root dir, launch python venv. This creates Pipfile and Pipfile.lock.
$pipenv --python 3.6
# If you would like to set up venv from Pipfiles made by another person, create venv and then install packages wirtten in Pipfiles
$pipenv install --deploy
(NOTE: --deploy causes build-fail when package has not been synced)
# Other commands
$pipenv import pandas==3.5 = $pipenv run pip install pandas==3.5
# Import python package into venv
$pipenv --python
# Import python package (which is not used in src) into venv
$pipenv install --dev flake8
# terminate venv by deleting ve
pip env --rm
# Go into the venv
$pipenv shell
# Go out of the venv
$exit
Tout d'abord, spécifiez la version python avec pyenv, puis créez un environnement virtualenv (nommé test). Une fois terminé, supprimez le répertoire de test.
$ cd ~/path_to/lambda_data_agg
$ pyenv local 3.6.0
$ virtualenv test
$ source test/bin/activate
$ pip install -r requirements.txt
#travail
$ deactive
$ rm -rf test
# create requirements.txt, at current directory
$ pipreqs .
# install packages listed in requirements.txt
$ pip install -r requirements.txt
Recommended Posts