Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pyenv + pipenv quick tutorial #3

Open
jiansoung opened this issue Oct 9, 2018 · 0 comments
Open

pyenv + pipenv quick tutorial #3

jiansoung opened this issue Oct 9, 2018 · 0 comments

Comments

@jiansoung
Copy link
Owner

jiansoung commented Oct 9, 2018

pyenv + pipenv quick tutorial

Python Development Workflow with Pyenv + Pipenv

Prerequisites

  • Install pyenv and some python version (I use 3.6.6)

Install Python with pyenv instead of Hombrew (if you use macOS).

NOTE: Do all the following commands in your own project directory.

STEP ONE

Set the shell-specific Python version:

$ pyenv shell 3.6.6

STEP TWO

  1. Downgrade pip to 18.0
  2. Install pipenv
  3. Create a new project using Python 3.6
  4. Downgrade virtualenv's pip to 18.0

Why downgrade pip to 18.0 ?

jwodder's answer:

This is a bug in pipenv caused by using it alongside the newest version of pip (18.1): pypa/pipenv#2924. You need to downgrade pip — both inside and outside the pipenv environment — to version 18.0 in order for pipenv to work.

ONLY EXECUTE FOLLOWING COMMANDS AT THE CREATION OF YOUR PROJECT

$ pip install --upgrade pip==18.0  # 1
$ pip install pipenv  # 2
$ pipenv install --python 3.6  # 3
$ pipenv run pip install --upgrade pip==18.0  # 4

STEP THREE

Install packages and use the installed packages

$ pipenv install <package>

Now that package is installed, you can use it in your python script. And then you can run your python script using pipenv run:

$ pipenv run python <your script>

Using $ pipenv run ensures that your installed packages are available to your script.

It’s also possible to spawn a new shell that ensures all commands have access to your installed packages with $ pipenv shell.

More

$ pipenv -h

References

  1. https://stackoverflow.com/a/52706841/7950607
  2. Running pipenv gives TypeError: 'module' object is not callable
  3. https://github.com/pypa/pipenv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant