Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add directory to Python path in PyCharm?

I want to be able to use the paraview.simple library in PyCharm. I already have paraview installed in my computer. This package cannot be installed with pip and there are no .whl files as far as I can tell. The website docs recommend that the directory containing all the python files be added to PYTHONPATH.

How do I add the relevant folder in PYTHONPATH on my PyCharm session, and keep it there by default, such that when I close out and reopen the paraview.simple library is still available?

like image 317
user32882 Avatar asked Feb 23 '18 12:02

user32882


People also ask

How do I give a directory path in PyCharm?

Press Ctrl+Alt+S to open the IDE settings and select Appearance & Behavior | Path Variables. and enter the name of the new variable (for example, DATA_PATH ) and its value that points to the target directory with the data file on your disk. Share the run/debug configuration through your version control system.

How do I add a directory to a path in Python?

Clicking on the Environment Variables button o​n the bottom right. In the System variables section, selecting the Path variable and clicking on Edit. The next screen will show all the directories that are currently a part of the PATH variable. Clicking on New and entering Python's install directory.

How do I install Python on PyCharm?

Choose the base interpreter from the list, or click and find a Python executable in the your file system. If PyCharm detects no Python on your machine, it provides two options: to download the latest Python versions from python.org or to specify a path to the Python executable (in case of non-standard installation).

How to add interpreter paths in PyCharm?

In that Menu, highlight your interpreter and then in the right menu, select the button "Show paths for the selected interpreter" (this is the last button) Show activity on this post. Adding interpreter paths in PyCharm: Show activity on this post. In PyCharm version 2020.3.1 use the following workflow instead (see official docs ):

What are PyCharm path variables?

To avoid complications when moving projects from one computer to another, PyCharm provides path variables. (A path variable, obviously, is a variable whose value is an absolute path to a directory or file.) Path variables are particularly useful when working with third-party libraries stored outside the project directory.

How do I create a new project in PyCharm?

In PyCharm, you can specify an interpreter that will be automatically set for all newly created projects. From the main menu, select File | New Projects Setup | Settings for New Projects (on Window and Linux) or File | New Projects Setup | Preferences for New Projects (on macOS).


Video Answer


2 Answers

You can add custom paths this way.

  • Go to File->Settings->project Interpreter
  • In the Project-Interpreter field, click the down facing arrow and select "show All"
  • In that Menu, highlight your interpreter and then in the right menu, select the button "Show paths for the selected interpreter" (this is the last button)
  • click the plus symbol to add your path
like image 135
FlyingTeller Avatar answered Oct 11 '22 21:10

FlyingTeller


Adding interpreter paths in PyCharm:

  1. Project Settings/Project Interpreter: select "settings" icon
  2. Project Interpreters: select "tree" icon
  3. Interpreter Paths: select "plus" icon

Screenshot

like image 43
Danijel Avatar answered Oct 11 '22 19:10

Danijel