Python Package Index atau PyPI merupakan repository dari pemrograman Python. PyPI akan membantu kita dalam mendapatkan dan menginsal aplikasi yang dibuat dan dibagikan oleh komunitas Python.
Pada artikel kali ini kita akan membuat virtual environment dan menginstal aplikasi tersebut pada virtual environment.
Python Package Index atau PyPI dan virtual environment adalah seperti pada contoh-contoh berikut ini
- Mengecek versi Python
C:\Users\Lenovo>python --version Python 3.8.2
- Mengecek versi modul pip
C:\Users\Lenovo>python -m pip --version pip 19.2.3 from C:\Program Files\Python38\lib\site-packages\pip (python 3.8)
- Membuat virtual environment
C:\WINDOWS\system32>python -m venv env01
- Mengaktifkan virtual environment
C:\WINDOWS\system32>env01\Scripts\activate (env01) C:\WINDOWS\system32>
- Melihat daftar modul yang sudah diinstal pada virtual environment
(env01) C:\WINDOWS\system32>python -m pip list Package Version ---------- ------- pip 19.2.3 setuptools 41.2.0 WARNING: You are using pip version 19.2.3, however version 23.2.1 is available. You should consider upgrading via the 'python -m pip install --upgrade pip' command.
- Menginstal modul pada virtual environment
(env01) C:\WINDOWS\system32>python -m pip install panda Collecting panda Downloading panda-0.3.1.tar.gz (5.8 kB) Installing build dependencies ... done Getting requirements to build wheel ... done Preparing metadata (pyproject.toml) ... done Requirement already satisfied: setuptools in c:\windows\system32\env01\lib\site-packages (from panda) (41.2.0) Collecting requests (from panda) Obtaining dependency information for requests from https://files.pythonhosted.org/packages/70/8e/0e2d847013cb52cd35b38c009bb167a1a26b2ce6cd6965bf26b47bc0bf44/requests-2.31.0-py3-none-any.whl.metadata Downloading requests-2.31.0-py3-none-any.whl.metadata (4.6 kB) Collecting charset-normalizer<4,>=2 (from requests->panda) Obtaining dependency information for charset-normalizer<4,>=2 from https://files.pythonhosted.org/packages/6b/b2/9d0c8fe83572a37bd66150399e289d8e96d62eca359ffa67c021b4120887/charset_normalizer-3.2.0-cp38-cp38-win_amd64.whl.metadata Downloading charset_normalizer-3.2.0-cp38-cp38-win_amd64.whl.metadata (31 kB) Collecting idna<4,>=2.5 (from requests->panda) Downloading idna-3.4-py3-none-any.whl (61 kB) ---------------------------------------- 61.5/61.5 kB 814.3 kB/s eta 0:00:00 Collecting urllib3<3,>=1.21.1 (from requests->panda) Obtaining dependency information for urllib3<3,>=1.21.1 from https://files.pythonhosted.org/packages/9b/81/62fd61001fa4b9d0df6e31d47ff49cfa9de4af03adecf339c7bc30656b37/urllib3-2.0.4-py3-none-any.whl.metadata Downloading urllib3-2.0.4-py3-none-any.whl.metadata (6.6 kB) Collecting certifi>=2017.4.17 (from requests->panda) Obtaining dependency information for certifi>=2017.4.17 from https://files.pythonhosted.org/packages/4c/dd/2234eab22353ffc7d94e8d13177aaa050113286e93e7b40eae01fbf7c3d9/certifi-2023.7.22-py3-none-any.whl.metadata Downloading certifi-2023.7.22-py3-none-any.whl.metadata (2.2 kB) Downloading requests-2.31.0-py3-none-any.whl (62 kB) ---------------------------------------- 62.6/62.6 kB 480.1 kB/s eta 0:00:00 Downloading certifi-2023.7.22-py3-none-any.whl (158 kB) ---------------------------------------- 158.3/158.3 kB 943.3 kB/s eta 0:00:00 Downloading charset_normalizer-3.2.0-cp38-cp38-win_amd64.whl (96 kB) ---------------------------------------- 96.2/96.2 kB 1.1 MB/s eta 0:00:00 Downloading urllib3-2.0.4-py3-none-any.whl (123 kB) ---------------------------------------- 123.9/123.9 kB 1.2 MB/s eta 0:00:00 Building wheels for collected packages: panda Building wheel for panda (pyproject.toml) ... done Created wheel for panda: filename=panda-0.3.1-py3-none-any.whl size=7247 sha256=33b89117a97cb161d5104b0810dabdaca8e5db9b229e9e88ee75a08de70524a0 Stored in directory: c:\users\lenovo\appdata\local\pip\cache\wheels\e9\b8\cc\e2f18ad77320b551f1b7435014844a9cc3e9d6185cb93a3a31 Successfully built panda Installing collected packages: urllib3, idna, charset-normalizer, certifi, requests, panda Successfully installed certifi-2023.7.22 charset-normalizer-3.2.0 idna-3.4 panda-0.3.1 requests-2.31.0 urllib3-2.0.4 (env01) C:\WINDOWS\system32>
- Mengupgrade modul pada virtual environment
(env01) C:\WINDOWS\system32>python -m pip install --upgrade pip Collecting pip Using cached https://files.pythonhosted.org/packages/50/c2/e06851e8cc28dcad7c155f4753da8833ac06a5c704c109313b8d5a62968a/pip-23.2.1-py3-none-any.whl Installing collected packages: pip Found existing installation: pip 19.2.3 Uninstalling pip-19.2.3: Successfully uninstalled pip-19.2.3 Successfully installed pip-23.2.1
- Melihat daftar modul yang sudah diinstal pada virtual environment
(env01) C:\WINDOWS\system32>python -m pip list Package Version ------------------ --------- certifi 2023.7.22 charset-normalizer 3.2.0 idna 3.4 panda 0.3.1 pip 23.2.1 requests 2.31.0 setuptools 41.2.0 urllib3 2.0.4
- Melihat daftar modul yang sudah diinstal pada system
C:\Users\Lenovo>python -m pip list Package Version ---------- ------- pip 19.2.3 setuptools 41.2.0 WARNING: You are using pip version 19.2.3, however version 23.2.1 is available. You should consider upgrading via the 'python -m pip install --upgrade pip' command.
Informasi lebih lanjut silahkan mengunjungi
1. https://pypi.org/ .
2. https://packaging.python.org/en/latest/tutorials/installing-packages/#installing-from-pypi .
Kunjungi www.proweb.co.id untuk menambah wawasan anda.
Python Package Index atau PyPI dan Virtual Environment