Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I properly setup pipenv in PyCharm?

I need krakenex in a project, so I import it with

import krakenex 

I have one version of krakenex in

/Users/x/Library/Python/3.6/lib/python/site-packages

. When I execute the script and

print(krakenex) 

it shows me the path mentioned above.

In the future, I want to use the modules from the packages I installed with e.g.

pipenv install krakenex 

with priority.

How do I manage to do that? Is it sufficient to add the path of the virtual environment to the sys path, or is there a more elegant way?

like image 419
Chris Jung Avatar asked Sep 16 '17 07:09

Chris Jung


People also ask

How do I set up Pipenv?

Set up a new project with PipenvOpen a console in your project directory and type pipenv install <package_name> to install a package for the project. To specify that the package is for development, use the -d flag. You can use pip syntax to denote a specific version of a package (e.g., black==13.0b1 ).

Should I use pip or Pipenv?

While pip can install Python packages, Pipenv is recommended as it's a higher-level tool that simplifies dependency management for common use cases. This does a user installation to prevent breaking any system-wide packages.


1 Answers

You should be pointing your Project Interpreter to the virtualenv python bin. So in PyCharm File->Settings->Project: ProjectName->Project Interpreter, then a windows showing the Project Interpreter should be displayed.

Project Interpreter

Next to the top dropdown is a gear and your going to want to Add Local and navigate to the virtualenvs python bin. Something like virtualenvs/virtualenv_name/bin/python. Then your project should be pointing to the right place.

like image 189
ForFunAndProfit Avatar answered Sep 20 '22 13:09

ForFunAndProfit