python-shell icon indicating copy to clipboard operation
python-shell copied to clipboard

How do I use pipenv?

Open guanzo opened this issue 5 years ago • 2 comments

How do I run python with pipenv run python, instead of python? I've installed a module with pipenv, and now I need the script to import that module, but it can't be found.

guanzo avatar May 12 '20 06:05 guanzo

Find the environment folder in your machine , something like /Users/me/.local/share/virtualenvs/folder-name-C0HELq_u/bin/python3

And use it as pythonPath

antenando avatar Jun 05 '20 19:06 antenando

I used

import { join } from "path";

PythonShell.defaultOptions = {
  pythonPath: join(execSync("pipenv --venv").toString().trim(), "Scripts/python"),
};

which seems to work fine and doesn't require any hardcoding paths

ardittristan avatar Apr 20 '21 17:04 ardittristan