시리즈 목록
윈도우(windows) WSL Ubuntu에 virtualenv 설치 및 vscode 연동
윈도우(windows) WSL Ubuntu에 pyenv 설치
윈도우(windows) WSL Ubuntu에 도커(Docker) 설치
윈도우(windows) WSL에 Ubuntu 20.04 LTS 추가 설치
윈도우(windows) WSL 명령어
윈도우(windows) WSL 설치 및 Ubuntu 구동
virtualenv 설치
apt를 이용한 설치
sudo apt install python3-virtualenv
gabriel@NB-15052600:~$ sudo apt install python3-virtualenv
[sudo] password for gabriel:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
javascript-common libjs-jquery libjs-sphinxdoc libjs-underscore libpython3-dev libpython3.10-dev
python3-dev python3-distlib python3-distutils python3-filelock python3-lib2to3 python3-pip python3-pip-whl
python3-platformdirs python3-setuptools python3-setuptools-whl python3-wheel python3-wheel-whl
python3.10-dev
Suggested packages:
apache2 | lighttpd | httpd python-setuptools-doc python2-pip-whl python2-setuptools-whl
The following NEW packages will be installed:
javascript-common libjs-jquery libjs-sphinxdoc libjs-underscore libpython3-dev libpython3.10-dev
python3-dev python3-distlib python3-distutils python3-filelock python3-lib2to3 python3-pip python3-pip-whl
python3-platformdirs python3-setuptools python3-setuptools-whl python3-virtualenv python3-wheel
python3-wheel-whl python3.10-dev
0 upgraded, 20 newly installed, 0 to remove and 0 not upgraded.
Need to get 10.6 MB of archives.
After this operation, 37.7 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://archive.ubuntu.com/ubuntu jammy/main amd64 javascript-common all 11+nmu1 [5936 B]
Get:2 http://archive.ubuntu.com/ubuntu jammy/main amd64 libjs-jquery all 3.6.0+dfsg+~3.5.13-1 [321 kB]
Get:3 http://archive.ubuntu.com/ubuntu jammy/main amd64 libjs-underscore all 1.13.2~dfsg-2 [118 kB]
Get:4 http://archive.ubuntu.com/ubuntu jammy/main amd64 libjs-sphinxdoc all 4.3.2-1 [139 kB]
Get:5 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 libpython3.10-dev amd64 3.10.6-1~22.04.2ubuntuPreparing to unpack .../19-python3-virtualenv_20.13.0+ds-2_all.deb ...
Unpacking python3-virtualenv (20.13.0+ds-2) ...
Setting up javascript-common (11+nmu1) ...
Setting up python3-setuptools-whl (59.6.0-1.2ubuntu0.22.04.1) ...
Setting up python3-filelock (3.6.0-1) ...
Setting up python3-pip-whl (22.0.2+dfsg-1ubuntu0.2) ...
Setting up python3-distlib (0.3.4-1) ...
Setting up python3-platformdirs (2.5.1-1) ...
Setting up libpython3.10-dev:amd64 (3.10.6-1~22.04.2ubuntu1) ...
Setting up python3.10-dev (3.10.6-1~22.04.2ubuntu1) ...
Setting up libjs-jquery (3.6.0+dfsg+~3.5.13-1) ...
Setting up python3-lib2to3 (3.10.6-1~22.04) ...
Setting up python3-wheel-whl (0.37.1-2ubuntu0.22.04.1) ...
Setting up libjs-underscore (1.13.2~dfsg-2) ...
Setting up python3-distutils (3.10.6-1~22.04) ...
Setting up libpython3-dev:amd64 (3.10.6-1~22.04) ...
Setting up python3-setuptools (59.6.0-1.2ubuntu0.22.04.1) ...
Setting up python3-wheel (0.37.1-2ubuntu0.22.04.1) ...
Setting up python3-pip (22.0.2+dfsg-1ubuntu0.2) ...
Setting up libjs-sphinxdoc (4.3.2-1) ...
Setting up python3-virtualenv (20.13.0+ds-2) ...
Setting up python3-dev (3.10.6-1~22.04) ...
Processing triggers for man-db (2.10.2-1) ...
gabriel@NB-15052600:~$
설치된 버전 확인
gabriel@NB-15052600:~$ virtualenv --version
virtualenv 20.23.0 from /home/gabriel/.local/lib/python3.11/site-packages/virtualenv/__init__.py
gabriel@NB-15052600:~$
pip를통해서 virtualenv를 설치
pip 로 설치했는데 virtualenv가 실행안되서 위의 apt로 추가로 설치했어요.
gabriel@NB-15052600:~$ python -m pip install --user virtualenv
Collecting virtualenv
Downloading virtualenv-20.23.0-py3-none-any.whl (3.3 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.3/3.3 MB 9.7 MB/s eta 0:00:00
Collecting distlib<1,>=0.3.6
Downloading distlib-0.3.6-py2.py3-none-any.whl (468 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 468.5/468.5 kB 9.1 MB/s eta 0:00:00
Collecting filelock<4,>=3.11
Downloading filelock-3.12.0-py3-none-any.whl (10 kB)
Collecting platformdirs<4,>=3.2
Downloading platformdirs-3.5.1-py3-none-any.whl (15 kB)
Installing collected packages: distlib, platformdirs, filelock, virtualenv
WARNING: The script virtualenv is installed in '/home/gabriel/.local/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed distlib-0.3.6 filelock-3.12.0 platformdirs-3.5.1 virtualenv-20.23.0
[notice] A new release of pip available: 22.3.1 -> 23.1.2
[notice] To update, run: pip install --upgrade pip
gabriel@NB-15052600:~$
virtualenv 가상환경 생성
virtualenv <환경이름> --python=<파이썬버전>
$ virtualenv auto --python=python3.11
virtualenv <환경이름> --python=<파이썬 설치경로>
$ virtualenv auto --python=/home/gabriel/.pyenv/shims/python
gabriel@NB-15052600:~/virtualenv$ virtualenv auto --python=python3.11
created virtual environment CPython3.11.3.final.0-64 in 650ms
creator CPython3Posix(dest=/home/gabriel/virtualenv/auto, clear=False, no_vcs_ignore=False, global=False)
seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/home/gabriel/.local/share/virtualenv)
added seed packages: pip==22.0.2, setuptools==59.6.0, wheel==0.37.1
activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator
gabriel@NB-15052600:~/virtualenv$
source ./auto/bin/activate
gabriel@NB-15052600:~/virtualenv$ ll
total 12
drwxr-xr-x 3 gabriel gabriel 4096 May 19 12:46 ./
drwxr-x--- 6 gabriel gabriel 4096 May 19 12:39 ../
drwxr-xr-x 4 gabriel gabriel 4096 May 19 12:46 auto/
gabriel@NB-15052600:~/virtualenv$ cd auto/
gabriel@NB-15052600:~/virtualenv/auto$ ll
total 24
drwxr-xr-x 4 gabriel gabriel 4096 May 19 12:46 ./
drwxr-xr-x 3 gabriel gabriel 4096 May 19 12:46 ../
-rw-r--r-- 1 gabriel gabriel 40 May 19 12:46 .gitignore
drwxr-xr-x 2 gabriel gabriel 4096 May 19 12:46 bin/
drwxr-xr-x 3 gabriel gabriel 4096 May 19 12:46 lib/
-rw-r--r-- 1 gabriel gabriel 337 May 19 12:46 pyvenv.cfg
gabriel@NB-15052600:~/virtualenv/auto$ source ./bin/activate
(auto) gabriel@NB-15052600:~/virtualenv/auto$ python -V
Python 3.11.3
(auto) gabriel@NB-15052600:~/virtualenv/auto$ which python
/home/gabriel/virtualenv/autogpt/bin/python
(auto) gabriel@NB-15052600:~/virtualenv/auto$
(auto) gabriel@NB-15052600:~/virtualenv/auto$ pip list
Package Version
---------- -------
pip 22.0.2
setuptools 59.6.0
wheel 0.37.1
(auto) gabriel@NB-15052600:~/virtualenv/auto$ pwd
/home/gabriel/virtualenv/auto
(auto) gabriel@NB-15052600:~/virtualenv/auto$ deactivate
gabriel@NB-15052600:~/virtualenv/auto$
Visual Studio Code 설치 및 WSL 연동
vscode에서 Remote Explorer에 Default 를 WSL Target > Ubuntu 로 default distro를 지정한다. (기존 아마 docker)
Ubuntu 명령창에서 code . 실행해서 VS Code 뜨는지 확인
만일 에러가 아래와 같이 발생하면 참조
https://github.com/microsoft/vscode/issues/148913
Terminal > New Terminal
'python > 개발환경구성' 카테고리의 다른 글
Mac에서 외장 Disk또는 SSD 엑세스하기 (0) | 2024.09.05 |
---|---|
윈도우(windows) WSL 명령어 (0) | 2023.05.15 |
윈도우(windows) WSL 설치 및 Ubuntu 구동 (0) | 2023.05.15 |