PyCharm에서 PYTHONPATH 설정하기

bashrc 또는 zshrc에 설정한 환경변수 PYTHONPATH의 설정을 pycharm에서 하는 방법이다.

You need to go to the Main PyCharm Preferences, which will open up a separate window. In the left pane, choose Project:... > Project Interpreter. Now, in the main pane on the right, click the settings symbol (gear symbol) next to the field for "Project Interpreter". Choose More in the menu that pops up. Now in the final step, pick the interpreter you are using for this project and click on the tree symbol at the bottom of the window (hovering over the symbol reveals it as "Show paths for the selected interpreter"). Add your path by click in the "plus" symbol.

It took me ages to find, so I hope the detailed instructions will help. Further details are available in the PyCharm docs.

It is good practice to have __init__.py in each subfolder of the module you are looking to add, as well as making your project folder a 'Source Root'. Simply right-click on the folder in the path bar and choose 'Mark Directory as ...'

https://stackoverflow.com/questions/28326362/pycharm-and-pythonpath?rq=1

Configure a Python interpreter

https://www.jetbrains.com/help/pycharm/configuring-python-interpreter.html

PYTHONPATH는 아래와 같이 커스텀 라이브러리들을 추가 할 수 있다.

Python Console에도 추가 할 수 있다.

#### 'Computer Science > Python' 카테고리의 다른 글

 Python과 C++ 함께 디버그 (혼합 디버깅)  (0) 2019.07.07 2019.07.05 2019.04.22 2018.04.25 2017.02.02 2017.01.31