Starting with Pipenv
Why pipenv instead of conda?
If you want to deploy your work, I think the best thing is to use pipenv. If you are trying to deploy your work to a small server, serverless, or Heroku, you probably don't want all 700+ packaages that conda comes with.
Pre-Install and Installation
If you do not, run
sudo apt-get update
Run
python3 --version
to see if you have python3 installedThen run
sudo apt-get install python3.x
where x is whatever version of python you would like. Right now it would bepython3.6
orpython3.7
After you know you have a modern version of python, run
sudo apt-get install python3-distutils
. If you do not add this library, there is a good chance pipenv will not work for you.Install pip3 with
sudo apt install python3-pip
with out thepip3
library, your system might try to rectify your new python3 packages with the python2.7 environment that ships with most operating systems. That will cause problems later on.install pipenv with
sudo -H pip3 install -U pipenv
.To create the virtual environment run
pipenv --three
to ensure your environment uses your python3.to activate and enter your new environment run
pipenv shell
If your Pipfile & Pipfile.lock are included in source control (git), after you clone a repo, you can just start the shell and run pipenv install
to get the same environment you were using on a different computer.
Installing Packages
The base command for installing packages is pipenv install package_name
. You can have as many packages as you want like pipenv install package1 package2 package3
.
Errors
Some times you get an error message that looks like the below.
If this is the case you can run install the latest version provided. So from the error above, the command would be pipenv install annoy==1.15.2
.
Last updated