---
title: "#이맥스 #통합개발환경: #파이썬"
url: "https://notes.junghanacs.com/notes/20240112T165512"
author: "Junghan Kim"
date: "2024-01-12T16:55:00+09:00"
lastmod: "2025-02-14T00:00:00+09:00"
tags: ["bib","emacside","python"]
description: "파이썬 개발을 이맥스 통합개발환경 안에서 풀기 위해 필요한 도구와 흐름을 정리한 실전 노트."
---

> [!abstract] 이 노트에 대하여
> 
> Python 개발을 Emacs 안에서 일관되게 다루기 위해 필요한 패키지와 흐름, 참고 자료를 모아 둔다. 단순 설치법보다도 파이썬 작업 전체를 어떤 원칙으로 통합할지에 관심이 실린 노트다.

## 관련노트

-   [#이맥스 #통합개발환경](https://notes.junghanacs.com/meta/20231123T040509)
-   [#파이썬](https://notes.junghanacs.com/meta/20240620T171551)

## BIBLIOGRAPHY

- “Emacswiki: Python Programming in Emacs.” 2025. 2025. <https://www.emacswiki.org/emacs/PythonProgrammingInEmacs>.
- Enzmann, Robert. 2022. “Python in Emacs: Vanilla Is a Powerful Flavor.” September 4, 2022. <https://robbmann.io/posts/006_emacs_2_python/>.
- “Junghan0611/Pylookup.” 2025. <https://github.com/junghan0611/pylookup>.
- Paul Winkler. 2024. “Modernizing My Python Development Setup in Emacs.” 2024. <https://slinkp.com/python-emacs-lsp-20231229.html>.
- *Python Development in Spacemacs*. 2020. <https://www.youtube.com/watch?v=r-BHx7VNX5s>.
- “Spacemacs #15 Python Repl and Live Coding.” n.d. Accessed February 19, 2025. <https://www.youtube.com/watch?v=o1w_-DKTDso>.

## 히스토리

-   [2025-05-28 Wed 13:24] 히스토리 관리를 해야겠다. 파이썬 관련 이슈가 너무 많아서 덤비기가 어렵다. 그럼에도 원칙은 단순함에 있다. 아래 있는 글들을 다 레벨2로 내리고 원점에서 봐야 한다.
    
    분류하자면, ... 이다.
-   [2024-01-12 Fri 16:55] Python IDE 를 위한 모든 것을 담아. 기본은 둠이다.

-   [jkitchin/scimax 이맥스 스타터키트 - 파이썬 주피터](https://notes.junghanacs.com/notes/20250218T111836)
-   [@martibosch snakemacs - 이맥스 스타터키트 - 파이썬 주피터](https://notes.junghanacs.com/notes/20250218T151435)
-   [#출판: #콰르토 #전자책 #퍼블리싱 #코드문서통합 #개정판자동화](https://notes.junghanacs.com/notes/20240125T164008)

## 관련링크

[2025-02-14 Fri 12:47]

### EmacsWiki: Python Programming In Emacs

([“Emacswiki: Python Programming in Emacs” 2025](https://notes.junghanacs.com/notes/20240112T165512#citeproc_bib_item_1))

### Modernizing my Python development setup in Emacs

([Paul Winkler 2024](https://notes.junghanacs.com/notes/20240112T165512#citeproc_bib_item_4))

### Python in Emacs: Vanilla is a Powerful Flavor

([Enzmann 2022](https://notes.junghanacs.com/notes/20240112T165512#citeproc_bib_item_2))

-   Enzmann, Robert
-   Intro There are a lot of great guides on getting set up with Python in Emacs.
-   Python in Emacs

### [Python Configuration for Emacs 29 - youtube.com](https://youtube.com/watch?v=SbTzIt6rISg&si=3NKR8-A5sijSmRbG)

## 정리 대기중

### 가상환경 관리

[2024-01-23 Tue 17:24]

우분투에서 개별 디렉토리에 패키지를 제한하고 싶다면 다른 것 없이 pipenv 사용하라.

-   [파이썬 관리자 conda-mamba 패키지 venv-uv 가상환경](https://notes.junghanacs.com/notes/20250217T142822) 너무 많다.
-   [astral-sh§uv 새로운 파이썬 가상환경 - 이맥스 활용법](https://notes.junghanacs.com/notes/20250214T134943) 이런 것도 나왔다.

#### virtualenv project deps

virtualenv 를 만들고 여기에 pyright 을 설치하고 Emacs 를 실행하는 방법. sandboxing 이 갈끔하겠지. 이래 하면 Emacs 설정 다 동작하나?!

pipenv 는 최신이다

```text
$ pipenv shell
$ pip3 install pyright
# $ emacs &
```

#### #가상환경: pipx with pylsp

[2024-09-09 Mon 13:07]

-   [#파이썬: #활용법: 미니콘다 설치 환경 구축](https://notes.junghanacs.com/notes/20240625T153507) 여기에도 안쓴다고 적어 놨다.
-   글을 확인해보니 이게 좋겠다. 콘다 문제도 마찬가지다. 빌트인은 아니다.

### 이맥스 #주피터 노트북 활용법

-   [주피터 파이썬 - 리눅스 qtconsole](https://notes.junghanacs.com/notes/20250222T190241)을 본다. 그 다음에 이맥스랑 놀아본다.
-   [§ob-jupyter 조직모드 바벨 파이썬 주피터](https://notes.junghanacs.com/notes/20240603T174450)

### 둠이맥스 : 파이썬 지원

[2024-06-03 Mon 17:44]

-   =&gt; 아래 관련 링크를 보고 주피터 패키지를 커버한다. 물론 예시는 책에 나와 있는

것들을 다루면 된다.

-   =&gt; 관련 링크 3개를 통합해서 하나의 그림으로 만들 되, 둠에서 제공하는 것들 부터

확인한다. 주피터 패키지가 제공하는 부분부터 확인해야 한다. 책에서 ipython 레플을 터미널에서 열어서 보여준다. 둠에 관련 기능이 있다.

-   modules/lang/python/autoload/python.el
-   +python/open-ipython-repl
    ```text
    
    Python 3.10.14 | packaged by conda-forge | (main, Mar 20 2024, 12:45:18) [GCC 12.3.0]
    Type 'copyright', 'credits' or 'license' for more information
    IPython 8.4.0 -- An enhanced Interactive Python. Type '?' for help.
    
    In [1]: kk
    ```

-   +python/open-repl
-   이건 안된다?!

아하! 이제 주피터 패키지를 볼 차례다.

이맥스에서 ein 과 jupyter 패키지가 핵심 역할을 하지 않는가! org 모듈에 서브로 다음과 같이 제공 된다.

```text
+jupyter                    ; ipython/jupyter support for babel
```

별도 모듈로 ein 이 있다. 사용하지 않는다. 일단!

-   jupyter-run-repl
-   설치된 라이브러리 동작 및 결과 확인 &gt; 바벨 출력
-   일단 둠 기본으로 다 해보고, 필요한 내용은 블로그 추가

### #apt 리눅스 우분투 파이썬 개발 환경 설치

-   import document Hangul
-   linker - flake8/pylint 를 flycheck 로 붙임 -- lsp 일때도?!
-   formatter - blacken 을 설치하는구만. format-on-save 는 lsp 와 연동 안되고 명시된 포메터와 동작.
-   pylsp

#### 우분투 패키지

[2025-02-18 Tue 15:32] 우분투에서는 패키지 검색해서 설치해야 한다. 다음 영상에서 참고했다. 이렇게 할 경우에 isort, black 까지 한 세트로 가져가면 된다. 이렇게 되면? black 도 설치되나 'lsp 거쳐서 할지 그냥 black 으로 바로 갈지는 결정하면 된다. 기본은 lsp 를 켜면 lsp 로 연결 될 것.

```shell
# bash 로 변경해서 설치한다. 왜? * 지원
bash

sudo apt-get install python3-pytest*
sudo apt-get install python3-debugpy
sudo apt-get install python3-poetry
sudo apt-get install python3-full

# check
sudo apt-get install python3-pandas python3-matplotlib python3-plotly

sudo apt-get install pipx
sudo apt-get install pipenv
sudo apt-get install autoflake flake8

sudo apt-get install python3-importmagic python3-pylsp-jsonrpc
```

#### #pylsp: 기본 LSP 선택 #우분투

pylsp 를 기본으로 사용하자. pyright 과 같은 정적 분석기를 설치하려면 python3-pylsp-mypy

```shell
sudo apt-get install python3-pylsp python3-pylsp-isort python3-pylsp-black python3-flake8
# python3-pylsp-mypy
```

#### [pypa§pipx 패키지 설치 목록](https://notes.junghanacs.com/notes/20250128T121922) 설치 패키지 목록

### [#파이썬: #활용법: 미니콘다 설치 환경 구축](https://notes.junghanacs.com/notes/20240625T153507) 크로스 플랫폼 공략

### junghan0611/pylookup

([“Junghan0611/Pylookup” 2025](https://notes.junghanacs.com/notes/20240112T165512#citeproc_bib_item_3))

-   Han, Jung
-   copy from spacemacs
-   3.12 패치
    ```elisp
    
    ;; (package! pylookup :recipe (:host github :repo "junghan0611/pylookup"))
    ;; (package! pylookup :recipe (:local-repo "local/pylookup"))
    
    (use-package! pylookup
      :commands (pylookup-lookup pylookup-update pylookup-update-all)
      :config
      ;; (spacemacs/set-leader-keys-for-major-mode 'python-mode
      ;;                                           "hH" 'pylookup-lookup)
      ;; (evilified-state-evilify-map pylookup-mode-map
      ;;                              :mode pylookup-mode)
      (setq
       pylookup-dir (concat user-dotemacs-dir "local/pylookup/")
       pylookup-program (concat pylookup-dir "pylookup.py")
       pylookup-db-file (concat pylookup-dir "pylookup.db"))
      (setq pylookup-completing-read 'completing-read)
      (setq pylookup-html-locations '("http://docs.python.org/ko/3.12")))
    
    ```

### #apt 파이썬 패키지 설치

```bash
sudo apt-get install autoflake flake8
sudo apt-get install python3-debugpy
sudo apt-get install jupyter
sudo apt-get install python3-pytest\*
sudo apt-get install python3-debugpy
sudo apt-get install python3-poetry
sudo apt-get install python3-full
sudo apt-get install python3-pandas python3-matplotlib python3-plotly
sudo apt-get install pipx
sudo apt-get install pipenv
sudo apt-get install autoflake flake8
sudo apt-get install python3-importmagic python3-pylsp-jsonrpc
sudo apt-get install python3-pylsp python3-pylsp-isort python3-pylsp-black python3-flake8
```

keras, flask

```shell
sudo apt-get install python3-keras-applications python3-psycopg2 python3-rdflib python3-bs4 python3-flask python3-jinja2
```

### PIPX 설치한 패키지 다 지워

```shell

error: unrecognized arguments: hyuga
(base) ~/git/clone main ⇡ ✘4 ?18 on ☁️  gtgkjh@gmail.com
➜ pipx uninstall hy
uninstalled hy! ✨ 🌟 ✨
(base) ~/git/clone main ⇡ ✘4 ?18 on ☁️  gtgkjh@gmail.com
➜ pipx uninstall hyuga
uninstalled hyuga! ✨ 🌟 ✨
(base) ~/git/clone main ⇡ ✘4 ?18 on ☁️  gtgkjh@gmail.com
➜ pipx uninstall hyrule
Nothing to uninstall for hyrule 😴
(base) ~/git/clone main ⇡ ✘4 ?18 on ☁️  gtgkjh@gmail.com
➜ pipx uninstall flask
uninstalled flask! ✨ 🌟 ✨
(base) ~/git/clone main ⇡ ✘4 ?18 on ☁️  gtgkjh@gmail.com
➜

```

### #pipx `머신러닝` 파이썬 패키지 설치

apt에 없는 경우

```shell
pipx install spacy tensorflow PyInquirer
# pipx install beautifulsoup4 Flask Jinja2 Keras psycopg2 rdflib rdflib-sqlite
```

### RAG - faiss

[2025-03-29 Sat 12:44]

-   [@defrecord 클로저 하이랭 조직모드 이맥스 LLM](https://notes.junghanacs.com/bib/20250327T134019)

openai 패키지

```shell

sudo apt-get install python3-openai
```

그리고 패키지

```shell

pipx install numpy faiss-cpu --include-deps

# ⚠️  File exists at /home/junghan/.local/bin/f2py and points to
#     /home/junghan/.local/bin/f2py, not
#     /home/junghan/.local/pipx/venvs/faiss-cpu/bin/f2py. Not modifying.
# ⚠️  File exists at /home/junghan/.local/bin/numpy-config and points to
#     /home/junghan/.local/bin/numpy-config, not
#     /home/junghan/.local/pipx/venvs/faiss-cpu/bin/numpy-config. Not modifying.
#   installed package faiss-cpu 1.10.0, installed using Python 3.12.3
#   These apps are now globally available
#     - f2py (symlink missing or pointing to unexpected location)
#     - numpy-config (symlink missing or pointing to unexpected location)
# done! ✨ 🌟 ✨
```

### `스페이스맥스` 파이썬 라이브 개발 환경

#### Spacemacs #15 Python REPL and Live Coding | 파이썬 REPL 과 라이브코딩 - YouTube

([“Spacemacs #15 Python Repl and Live Coding” n.d.](https://notes.junghanacs.com/notes/20240112T165512#citeproc_bib_item_6))

1.  REPL(READ-EVAL-PRINT LOOP: 대화형 인터랙티브 쉘)

You can evaluate your codes in real time using REPL. REPL쉘을 이용해 실시간으로 코드를 실행시켜보고 결과를 볼 수 있습니다.

ipython

-   [SPC m s i] Start or Switch REPL
-   [SPC m s b] Send Buffer to REPL - spacemacs/python-shell-send-defun
-   [SPC m s f] Send Function to REPL

-   Live Coding(라이브 코딩)

Live Coding is easier to evaluate your code than using REPL. 라이브코딩을 사용하면 좀 더 쉬운 실시간 코드 테스트를 할 수 있습니다.

[SPC m l] Toggle Live Coding

#### Python Development in Spacemacs

(<a href="#citeproc_bib_item_5">*Python Development in Spacemacs* 2020</a>)

-   Post Editing Notes: 1. ‘spc spc‘ and then ‘workon‘ to find the command for switching virtualenvs. It’s not clear in the video. Apologies for that. 2. the packages I install are flake8 isort yapf python-language-server In this video I cover the absolute minimum setup for doing Python development in Spacemacs. I start off with a discussion of Python virtualenvs and how to get them set up correctly for Spacemacs. Then a discussion of code completion. Afterwards I show how to explore and fix issues found by a linter (flake8) And then go over how to run scripts from inside emacs. Finally I demonstrate a language server based completion backend. Twitter: `~/~safijari~` Channel github: <https://github.com/safijari/jack-of-s>... Thumbnail Background by Dave on Upsplash: <https://unsplash.com/@johnwestrock> #spacemacs #python #development
-   2020

### basedpyright

[2025-02-19 Wed 17:44]

일단 툴 설치

```shell
pipx uninstall pyright
pipx install basedpyright
  # installed package basedpyright 1.27.1, installed using Python 3.12.3
  # These apps are now globally available
  #   - basedpyright
  # - basedpyright-langserver
```

둠이맥스 설정

```elisp
(when (modulep! :lang python +pyright)
  (after! lsp-pyright
    (setq lsp-pyright-langserver-command "basedpyright")))
```

잘동작합니다.

```text
~ via  v20.14.0 
➜ ps aux | grep pyright    
junghan   460372  0.0  0.1  24664 12768 ?        Ss   17:46   0:00 /home/junghan/.local/pipx/venvs/basedpyright/bin/python /home/junghan/.local/bin/basedpyright-langserver --stdio
junghan   460374  2.9  1.2 1091656 147772 ?      Sl   17:46   0:02 /home/junghan/.local/pipx/venvs/basedpyright/lib/python3.12/site-packages/nodejs_wheel/bin/node /home/junghan/.local/pipx/venvs/basedpyright/lib/python3.12/site-packages/basedpyright/langserver.index.js --stdio
junghan   464495  0.0  0.0  10488  2304 pts/3    S+   17:47   0:00 grep --color=auto pyright
~ via  v20.14.0 
```

### python-guess-indent-offset 메시지

파이썬 팁에 넣어 둘것.

[그것으로 말미암아, : 네이버 블로그 - blog.naver.com](https://blog.naver.com/jodi999/223560199662?fromRss=true&trackingCode=rss)

둠이맥스에는 이미 적용되어 있더라.

```elisp
(setq python-indent-guess-indent-offset-verbose nil)

# -*- mode" python; python-indent-offset: 2 -*-
```

## Too many leading '#' for block comment (E266) 무시

@assistant "Too many leading '#' for block comment (E266)" 오류를 무시하려면, pycodestyle 설정 파일에서 이 경고를 무시하도록 설정할 수 있습니다. 일반적으로 `setup.cfg` 나 `tox.ini` 파일에서 다음과 같이 설정할 수 있습니다:

```ini
[pycodestyle]
ignore = E266
```

이렇게 설정하면, pycodestyle이 여러 개의 해시 기호(#)로 시작하는 주석에 대해 경고를 출력하지 않습니다.

-   Citations: [1] <https://github.com/Glavin001/atom-beautify/issues/2304>

## Termux 파이썬 패키지 - 주피터

[2025-05-28 Wed 13:35]

이렇게 설치하면 되더라.

/home/junghan/org/android/jupy.sh

```shell
pkg i python
pkg i python-numpy
pkg i matplotlib

pkg install python-pip clang build-essential
pkg install rust
pip install rpds-py

# pkg i python-pandas
pip install seaborn
pkg i libzmq
pip install pyzmq

pip install jupyter
# jupyter notebook &
```
