venv 설치
$ sudo apt install python3-venv
[ 실행 로그 ]
gangserver@RC530-U:~$ sudo apt install python3-venv
[sudo] gangserver 암호:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
python3-pip-whl python3-setuptools-whl python3.12-venv
The following NEW packages will be installed:
python3-pip-whl python3-setuptools-whl python3-venv python3.12-venv
0 upgraded, 4 newly installed, 0 to remove and 8 not upgraded.
Need to get 2,425 kB of archives.
After this operation, 2,777 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://kr.archive.ubuntu.com/ubuntu noble-updates/universe amd64 python3-pip-whl all 24.0+dfsg-1ubuntu1.1 [1,703 kB]
Get:2 http://kr.archive.ubuntu.com/ubuntu noble-updates/universe amd64 python3-setuptools-whl all 68.1.2-2ubuntu1.1 [716 kB]
Get:3 http://kr.archive.ubuntu.com/ubuntu noble-updates/universe amd64 python3.12-venv amd64 3.12.3-1ubuntu0.5 [5,678 B]
Get:4 http://kr.archive.ubuntu.com/ubuntu noble-updates/universe amd64 python3-venv amd64 3.12.3-0ubuntu2 [1,034 B]
Fetched 2,425 kB in 4s (602 kB/s)
Selecting previously unselected package python3-pip-whl.
(Reading database ... 178007 files and directories currently installed.)
Preparing to unpack .../python3-pip-whl_24.0+dfsg-1ubuntu1.1_all.deb ...
Unpacking python3-pip-whl (24.0+dfsg-1ubuntu1.1) ...
Selecting previously unselected package python3-setuptools-whl.
Preparing to unpack .../python3-setuptools-whl_68.1.2-2ubuntu1.1_all.deb ...
Unpacking python3-setuptools-whl (68.1.2-2ubuntu1.1) ...
Selecting previously unselected package python3.12-venv.
Preparing to unpack .../python3.12-venv_3.12.3-1ubuntu0.5_amd64.deb ...
Unpacking python3.12-venv (3.12.3-1ubuntu0.5) ...
Selecting previously unselected package python3-venv.
Preparing to unpack .../python3-venv_3.12.3-0ubuntu2_amd64.deb ...
Unpacking python3-venv (3.12.3-0ubuntu2) ...
Setting up python3-setuptools-whl (68.1.2-2ubuntu1.1) ...
Setting up python3-pip-whl (24.0+dfsg-1ubuntu1.1) ...
Setting up python3.12-venv (3.12.3-1ubuntu0.5) ...
Setting up python3-venv (3.12.3-0ubuntu2) ...
venv 설정
(설정할 디렉토리 이동 후)
$ cd devel
(venv 환경설정 디렉토리인 .venv는 다른 이름으로 변경 가능)
$ python3 -m venv .venv
[ 실행 로그 ]
gangserver@gooroom:~/devel$ python3 -m venv .venv
gangserver@gooroom:~/devel$
venv 환경설정(.venv) 디렉토리 생성 확인
gangserver@RC530-U:~/devel$ ls -al
합계 116
drwxrwxr-x 11 gangserver gangserver 4096 3월 27 17:36 .
drwxrwxr-x 6 gangserver gangserver 4096 3월 27 17:17 ..
drwxrwxr-x 5 gangserver gangserver 4096 3월 27 17:36 .venv
gangserver@RC530-U:~/devel$ cd .venv
gangserver@RC530-U:~/devel/.venv$ ls -al
합계 24
drwxrwxr-x 5 gangserver gangserver 4096 3월 27 17:36 .
drwxrwxr-x 11 gangserver gangserver 4096 3월 27 17:36 ..
drwxrwxr-x 2 gangserver gangserver 4096 3월 27 17:36 bin
drwxrwxr-x 3 gangserver gangserver 4096 3월 27 17:36 include
drwxrwxr-x 3 gangserver gangserver 4096 3월 27 17:36 lib
lrwxrwxrwx 1 gangserver gangserver 3 3월 27 17:36 lib64 -> lib
-rw-rw-r-- 1 gangserver gangserver 172 3월 27 17:36 pyvenv.cfg
(.venv/bin 디렉토리에 활성화(activate) 파일 등이 정상적으로 보이는지 확인)
gangserver@RC530-U:~/devel/.venv$ cd bin
gangserver@RC530-U:~/devel/.venv/bin$ ls -al
합계 44
drwxrwxr-x 2 gangserver gangserver 4096 3월 27 17:36 ./
drwxrwxr-x 5 gangserver gangserver 4096 3월 27 17:36 ../
-rw-r--r-- 1 gangserver gangserver 9033 3월 27 17:36 Activate.ps1
-rw-r--r-- 1 gangserver gangserver 2058 3월 27 17:36 activate
-rw-r--r-- 1 gangserver gangserver 932 3월 27 17:36 activate.csh
-rw-r--r-- 1 gangserver gangserver 2207 3월 27 17:36 activate.fish
-rwxrwxr-x 1 gangserver gangserver 250 3월 27 17:36 pip*
-rwxrwxr-x 1 gangserver gangserver 250 3월 27 17:36 pip3*
-rwxrwxr-x 1 gangserver gangserver 250 3월 27 17:36 pip3.12*
lrwxrwxrwx 1 gangserver gangserver 15 3월 27 17:36 python -> /usr/bin/python*
lrwxrwxrwx 1 gangserver gangserver 6 3월 27 17:36 python3 -> python*
lrwxrwxrwx 1 gangserver gangserver 6 3월 27 17:36 python3.12 -> python*
venv 활성화
(작업 폴더 이동 후)
gangserver@RC530-U:~/devel/.venv/bin$ cd ../../
$ source .venv/bin/activate
[ 실행 로그 ]
(앞에 (.venv)가 표시되면 활성화된 상태)
gangserver@RC530-U:~/devel$ source .venv/bin/activate
(.venv) gangserver@RC530-U:~/devel$
파이썬 모듈 설치
(.venv) gangserver@RC530-U:~/devel$ pip install --upgrade numpy pandas matplotlib scikit-learn
...
(모듈 설치됨)
...
venv 비활성화
(앞에 (.venv)가 안보이면 비활성화된 상태)
(.venv) gangserver@RC530-U:~/devel$ deactivate
gangserver@RC530-U:~/devel$
'OS > Ubuntu' 카테고리의 다른 글
Ubuntu 24.04 Flatpak install (0) | 2025.03.28 |
---|---|
Ubuntu 24.04 VLC installed with snap error (0) | 2025.03.27 |
Ubuntu 24.04 MariaDB 설치 및 서비스 구동 (0) | 2025.03.27 |
libQt5PrintSupport.so.5 error when running double commander (doublecmd) qt version on Ubuntu 24.04 (0) | 2025.03.27 |
Ubuntu / Check Intel Integrated GPU (0) | 2025.03.22 |