I need krakenex in a project, so I import it with
I have one version of krakenex in
. When I execute the script and
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
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?
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.
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.
To add more clarification on how to setup PyCharm with pipenv for now:
Execute in your project directory
Save the output, you’ll reference this path later
Note that you will need to use the command line to install any packages since PyCharm currently doesn’t support pipenv in their package management tools. However, I haven’t had a problem with this method.
PyCharm natively supports pipenv since version
2018.2. PyCharm 2018.2 will automatically create a pipenv when you open a project with a Pipfile, and makes it easy to create new projects with pipenvs.
For existing projects
As previously stated, for existing projects with a
Pipfile, when you open a Python file, PyCharm will ask you if you want to install the dependencies from the
For new projects
For a new project, you can use the project interpreter panel to create a
Pipenv based project interpreter.