python pip command example
python pip install:
userName:~$ cd python/ userName:~/python$ ls panTestProjects userName:~/python$ cd panTestProjects/ userName:~/python/panTestProjects$ ls py3_8_numpy1_22_pandas1_4 userName:~/python/panTestProjects$ python -v Command 'python' not found, did you mean: command 'python3' from deb python3 command 'python' from deb python-is-python3 userName:~/python/panTestProjects$ python -V Command 'python' not found, did you mean: command 'python3' from deb python3 command 'python' from deb python-is-python3 userName:~/python/panTestProjects$ py -V Command 'py' not found, but can be installed with: sudo apt install pythonpy userName:~/python/panTestProjects$ pip -V pip 22.3.1 from /home/panxi/.local/lib/python3.8/site-packages/pip (python 3.8) userName:~/python/panTestProjects$ pip3 -V pip 22.3.1 from /home/panxi/.local/lib/python3.8/site-packages/pip (python 3.8) userName:~/python/panTestProjects$ apt install python-pip E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied) E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root? userName:~/python/panTestProjects$ sudo apt install python-pip [sudo] password for panxi: Reading package lists... Done Building dependency tree Reading state information... Done Package python-pip is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source However the following packages replace it: python3-pip E: Package 'python-pip' has no installation candidate userName:~/python/panTestProjects$ python3 -V Python 3.8.10 userName:~/python/panTestProjects$ sudo apt install python3-pip Reading package lists... Done Building dependency tree Reading state information... Done python3-pip is already the newest version (20.0.2-5ubuntu1.6). 0 upgraded, 0 newly installed, 0 to remove and 167 not upgraded. userName:~/python/panTestProjects$ pip3 -V pip 22.3.1 from /home/panxi/.local/lib/python3.8/site-packages/pip (python 3.8) userName:~/python/panTestProjects$
package install using pip
Package Version ---------------------- -------------------- attrs 19.3.0 Automat 0.8.0 blinker 1.4 certifi 2019.11.28 chardet 3.0.4 Click 7.0 cloud-init 21.4 colorama 0.4.3 command-not-found 0.3 configobj 5.0.6 constantly 15.1.0 cryptography 2.8 dbus-python 1.2.16 distro 1.4.0 distro-info 0.23ubuntu1 entrypoints 0.3 httplib2 0.14.0 hyperlink 19.0.0 idna 2.8 importlib-metadata 1.5.0 incremental 16.10.1 Jinja2 2.10.1 jsonpatch 1.22 jsonpointer 2.0 jsonschema 3.2.0 keyring 18.0.1 language-selector 0.1 launchpadlib 1.10.13 lazr.restfulclient 0.14.2 lazr.uri 1.0.3 MarkupSafe 1.1.0 more-itertools 4.2.0 netifaces 0.10.4 numpy 1.22.0 oauthlib 3.1.0 pandas 1.4.0 pexpect 4.6.0 pip 22.3.1 pyasn1 0.4.2 pyasn1-modules 0.2.1 PyGObject 3.36.0 PyHamcrest 1.9.0 PyJWT 1.7.1 pymacaroons 0.13.0 PyNaCl 1.3.0 pyOpenSSL 19.0.0 pyrsistent 0.15.5 pyserial 3.4 python-apt 2.0.0+ubuntu0.20.4.7 python-dateutil 2.8.2 python-debian 0.1.36ubuntu1 pytz 2022.7.1 PyYAML 5.3.1 requests 2.22.0 requests-unixsocket 0.2.0 SecretStorage 2.3.1 service-identity 18.1.0 setuptools 45.2.0 simplejson 3.16.0 six 1.14.0 sos 4.2 ssh-import-id 5.10 systemd-python 234 Twisted 18.9.0 ubuntu-advantage-tools 27.6 ufw 0.36 unattended-upgrades 0.1 urllib3 1.25.8 wadllib 1.3.3 wheel 0.34.2 zipp 1.0.0 zope.interface 4.7.1 [notice] A new release of pip available: 22.3.1 -> 23.0 [notice] To update, run: python3 -m pip install --upgrade pip userName:~/python/panTestProjects$ pip install babel Defaulting to user installation because normal site-packages is not writeable Collecting babel Downloading Babel-2.11.0-py3-none-any.whl (9.5 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 9.5/9.5 MB 5.2 MB/s eta 0:00:00 Requirement already satisfied: pytz>=2015.7 in /home/panxi/.local/lib/python3.8/site-packages (from babel) (2022.7.1) Installing collected packages: babel Successfully installed babel-2.11.0 [notice] A new release of pip available: 22.3.1 -> 23.0 [notice] To update, run: python3 -m pip install --upgrade pip userName:~/python/panTestProjects$ pip list Package Version ---------------------- -------------------- attrs 19.3.0 Automat 0.8.0 Babel 2.11.0 blinker 1.4 certifi 2019.11.28 chardet 3.0.4 Click 7.0 cloud-init 21.4 colorama 0.4.3 command-not-found 0.3 configobj 5.0.6 constantly 15.1.0 cryptography 2.8 dbus-python 1.2.16 distro 1.4.0 distro-info 0.23ubuntu1 entrypoints 0.3 httplib2 0.14.0 hyperlink 19.0.0 idna 2.8 importlib-metadata 1.5.0 incremental 16.10.1 Jinja2 2.10.1 jsonpatch 1.22 jsonpointer 2.0 jsonschema 3.2.0 keyring 18.0.1 language-selector 0.1 launchpadlib 1.10.13 lazr.restfulclient 0.14.2 lazr.uri 1.0.3 MarkupSafe 1.1.0 more-itertools 4.2.0 netifaces 0.10.4 numpy 1.22.0 oauthlib 3.1.0 pandas 1.4.0 pexpect 4.6.0 pip 22.3.1 pyasn1 0.4.2 pyasn1-modules 0.2.1 PyGObject 3.36.0 PyHamcrest 1.9.0 PyJWT 1.7.1 pymacaroons 0.13.0 PyNaCl 1.3.0 pyOpenSSL 19.0.0 pyrsistent 0.15.5 pyserial 3.4 python-apt 2.0.0+ubuntu0.20.4.7 python-dateutil 2.8.2 python-debian 0.1.36ubuntu1 pytz 2022.7.1 PyYAML 5.3.1 requests 2.22.0 requests-unixsocket 0.2.0 SecretStorage 2.3.1 service-identity 18.1.0 setuptools 45.2.0 simplejson 3.16.0 six 1.14.0 sos 4.2 ssh-import-id 5.10 systemd-python 234 Twisted 18.9.0 ubuntu-advantage-tools 27.6 ufw 0.36 unattended-upgrades 0.1 urllib3 1.25.8 wadllib 1.3.3 wheel 0.34.2 zipp 1.0.0 zope.interface 4.7.1 [notice] A new release of pip available: 22.3.1 -> 23.0 [notice] To update, run: python3 -m pip install --upgrade pip userName:~/python/panTestProjects$ pip uninstall babel Found existing installation: Babel 2.11.0 Uninstalling Babel-2.11.0: Would remove: /home/panxi/.local/bin/pybabel /home/panxi/.local/lib/python3.8/site-packages/Babel-2.11.0.dist-info/* /home/panxi/.local/lib/python3.8/site-packages/babel/* Proceed (Y/n)? y Successfully uninstalled Babel-2.11.0 userName:~/python/panTestProjects$ pip list Package Version ---------------------- -------------------- attrs 19.3.0 Automat 0.8.0 blinker 1.4 certifi 2019.11.28 chardet 3.0.4 Click 7.0 cloud-init 21.4 colorama 0.4.3 command-not-found 0.3 configobj 5.0.6 constantly 15.1.0 cryptography 2.8 dbus-python 1.2.16 distro 1.4.0 distro-info 0.23ubuntu1 entrypoints 0.3 httplib2 0.14.0 hyperlink 19.0.0 idna 2.8 importlib-metadata 1.5.0 incremental 16.10.1 Jinja2 2.10.1 jsonpatch 1.22 jsonpointer 2.0 jsonschema 3.2.0 keyring 18.0.1 language-selector 0.1 launchpadlib 1.10.13 lazr.restfulclient 0.14.2 lazr.uri 1.0.3 MarkupSafe 1.1.0 more-itertools 4.2.0 netifaces 0.10.4 numpy 1.22.0 oauthlib 3.1.0 pandas 1.4.0 pexpect 4.6.0 pip 22.3.1 pyasn1 0.4.2 pyasn1-modules 0.2.1 PyGObject 3.36.0 PyHamcrest 1.9.0 PyJWT 1.7.1 pymacaroons 0.13.0 PyNaCl 1.3.0 pyOpenSSL 19.0.0 pyrsistent 0.15.5 pyserial 3.4 python-apt 2.0.0+ubuntu0.20.4.7 python-dateutil 2.8.2 python-debian 0.1.36ubuntu1 pytz 2022.7.1 PyYAML 5.3.1 requests 2.22.0 requests-unixsocket 0.2.0 SecretStorage 2.3.1 service-identity 18.1.0 setuptools 45.2.0 simplejson 3.16.0 six 1.14.0 sos 4.2 ssh-import-id 5.10 systemd-python 234 Twisted 18.9.0 ubuntu-advantage-tools 27.6 ufw 0.36 unattended-upgrades 0.1 urllib3 1.25.8 wadllib 1.3.3 wheel 0.34.2 zipp 1.0.0 zope.interface 4.7.1 [notice] A new release of pip available: 22.3.1 -> 23.0 [notice] To update, run: python3 -m pip install --upgrade pip userName:~/python/panTestProjects$ pip install -U babel Defaulting to user installation because normal site-packages is not writeable Collecting babel Using cached Babel-2.11.0-py3-none-any.whl (9.5 MB) Requirement already satisfied: pytz>=2015.7 in /home/panxi/.local/lib/python3.8/site-packages (from babel) (2022.7.1) Installing collected packages: babel Successfully installed babel-2.11.0 [notice] A new release of pip available: 22.3.1 -> 23.0 [notice] To update, run: python3 -m pip install --upgrade pip userName:~/python/panTestProjects$ pip list Package Version ---------------------- -------------------- attrs 19.3.0 Automat 0.8.0 Babel 2.11.0 blinker 1.4 certifi 2019.11.28 chardet 3.0.4 Click 7.0 cloud-init 21.4 colorama 0.4.3 command-not-found 0.3 configobj 5.0.6 constantly 15.1.0 cryptography 2.8 dbus-python 1.2.16 distro 1.4.0 distro-info 0.23ubuntu1 entrypoints 0.3 httplib2 0.14.0 hyperlink 19.0.0 idna 2.8 importlib-metadata 1.5.0 incremental 16.10.1 Jinja2 2.10.1 jsonpatch 1.22 jsonpointer 2.0 jsonschema 3.2.0 keyring 18.0.1 language-selector 0.1 launchpadlib 1.10.13 lazr.restfulclient 0.14.2 lazr.uri 1.0.3 MarkupSafe 1.1.0 more-itertools 4.2.0 netifaces 0.10.4 numpy 1.22.0 oauthlib 3.1.0 pandas 1.4.0 pexpect 4.6.0 pip 22.3.1 pyasn1 0.4.2 pyasn1-modules 0.2.1 PyGObject 3.36.0 PyHamcrest 1.9.0 PyJWT 1.7.1 pymacaroons 0.13.0 PyNaCl 1.3.0 pyOpenSSL 19.0.0 pyrsistent 0.15.5 pyserial 3.4 python-apt 2.0.0+ubuntu0.20.4.7 python-dateutil 2.8.2 python-debian 0.1.36ubuntu1 pytz 2022.7.1 PyYAML 5.3.1 requests 2.22.0 requests-unixsocket 0.2.0 SecretStorage 2.3.1 service-identity 18.1.0 setuptools 45.2.0 simplejson 3.16.0 six 1.14.0 sos 4.2 ssh-import-id 5.10 systemd-python 234 Twisted 18.9.0 ubuntu-advantage-tools 27.6 ufw 0.36 unattended-upgrades 0.1 urllib3 1.25.8 wadllib 1.3.3 wheel 0.34.2 zipp 1.0.0 zope.interface 4.7.1 [notice] A new release of pip available: 22.3.1 -> 23.0 [notice] To update, run: python3 -m pip install --upgrade pip userName:~/python/panTestProjects$
add file at ubuntu on windows using WSL & change file's permission
# linux on window path: C:\Users\[user]]\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu20.04onWindows_79rhkp1fndgsc\LocalState\rootfs [username]:~$ ls python [username]:~$ path Command 'path' not found, did you mean: command 'mpath' from deb libmodule-path-perl (0.19-1) command 'patch' from deb patch (2.7.6-6) command 'pat' from deb dist (1:3.5-236-0.1build1) command 'xpath' from deb libxml-xpath-perl (1.44-1) command 'path6' from deb ipv6toolkit (2.0-1) Try: sudo apt install <deb name> [username]:~$ env SHELL=/bin/bash WSL_DISTRO_NAME=Ubuntu-20.04 WT_SESSION=6a834d2f-fec0-4835-bcfa-45b3f38d1f28 NAME=SLB-3D05SQ3 PWD=/home/panxi LOGNAME=panxi HOME=/home/panxi LANG=C.UTF-8 LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36: LESSCLOSE=/usr/bin/lesspipe %s %s TERM=xterm-256color LESSOPEN=| /usr/bin/lesspipe %s USER=panxi SHLVL=1 WSLENV=WT_SESSION::WT_PROFILE_ID XDG_DATA_DIRS=/usr/local/share:/usr/share:/var/lib/snapd/desktop PATH=/home/panxi/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/mnt/c/Program Files/Python38/Scripts/:/mnt/c/Program Files/Python38/:/mnt/c/Python311/Scripts/:/mnt/c/Python311/:/mnt/c/Program Files/Microsoft/jdk-11.0.12.7-hotspot/bin:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/Program Files/Microsoft SQL Server/150/Tools/Binn/:/mnt/c/Program Files/Microsoft SQL Server/Client SDK/ODBC/170/Tools/Binn/:/mnt/c/Program Files/dotnet/:/mnt/c/Program Files/Git/cmd:/mnt/c/Program Files/MongoDB/mongodb-database-tools-windows-x86_64-100.6.1/bin:/mnt/c/Program Files/MongoDB/mongosh/mongosh-1.6.0-win32-x64/mongosh-1.6.0-win32-x64/bin:/mnt/c/Program Files/MongoDB/Server/6.0/bin:/mnt/c/ProgramData/mambaforge:/mnt/c/Program Files/k6/:/mnt/c/Program Files/nodejs/:/mnt/c/ProgramData/chocolatey/bin:/mnt/c/Program Files/Docker/Docker/resources/bin:/mnt/c/Users/PXi/Anaconda3_python3_8:/mnt/c/Users/PXi/Anaconda3_python3_8/Library/mingw-w64/bin:/mnt/c/Users/PXi/Anaconda3_python3_8/Library/usr/bin:/mnt/c/Users/PXi/Anaconda3_python3_8/Library/bin:/mnt/c/Users/PXi/Anaconda3_python3_8/Scripts:/mnt/c/Users/PXi/Anaconda3:/mnt/c/Users/PXi/Anaconda3/Library/mingw-w64/bin:/mnt/c/Users/PXi/Anaconda3/Library/usr/bin:/mnt/c/Users/PXi/Anaconda3/Library/bin:/mnt/c/Users/PXi/Anaconda3/Scripts:/mnt/c/Users/PXi/AppData/Local/Programs/Python/Python38/Scripts/:/mnt/c/Users/PXi/AppData/Local/Programs/Python/Python38/:/mnt/c/Users/PXi/AppData/Local/Programs/Python/Python37/Scripts/:/mnt/c/Users/PXi/AppData/Local/Programs/Python/Python37/:/mnt/c/Users/PXi/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/PXi/.dotnet/tools:/mnt/c/Users/PXi/AppData/Local/Programs/Microsoft VS Code/bin:/mnt/c/Users/PXi/AppData/Roaming/npm:/snap/bin HOSTTYPE=x86_64 WT_PROFILE_ID={07b52e3e-de2c-5db4-bd2d-ba144ed6c273} _=/usr/bin/env [username]:~$ ls python [username]:~$ cd python/ [username]:~/python$ ls managing-python-packages-virtual-environments managing-python-packages-virtual-environments.zip panTestProjects [username]:~/python$ cd managing-python-packages-virtual-environments/ -bash: cd: managing-python-packages-virtual-environments/: Permission denied [username]:~/python$ ls managing-python-packages-virtual-environments managing-python-packages-virtual-environments.zip panTestProjects [username]:~/python$ sudo cd managing-python-packages-virtual-environments/ [sudo] password for panxi: sudo: cd: command not found [username]:~/python$ ls -l total 1020 d--------- 1 panxi panxi 512 Feb 2 09:43 managing-python-packages-virtual-environments ---------- 1 panxi panxi 1044096 Feb 2 09:30 managing-python-packages-virtual-environments.zip drwxr-xr-x 1 panxi panxi 512 Jan 20 22:38 panTestProjects [username]:~/python$ chmod drwxr-xr-x managing-python-packages-virtual-environments chmod: invalid mode: ‘drwxr-xr-x’ Try 'chmod --help' for more information. [username]:~/python$ chmod u+rwxr managing-python-packages-virtual-environments [username]:~/python$ ls -l total 1020 drwx------ 1 panxi panxi 512 Feb 2 09:43 managing-python-packages-virtual-environments ---------- 1 panxi panxi 1044096 Feb 2 09:30 managing-python-packages-virtual-environments.zip drwxr-xr-x 1 panxi panxi 512 Jan 20 22:38 panTestProjects [username]:~/python$ chmod g+rwxr managing-python-packages-virtual-environments [username]:~/python$ ls -l total 1020 drwxrwx--- 1 panxi panxi 512 Feb 2 09:43 managing-python-packages-virtual-environments ---------- 1 panxi panxi 1044096 Feb 2 09:30 managing-python-packages-virtual-environments.zip drwxr-xr-x 1 panxi panxi 512 Jan 20 22:38 panTestProjects [username]:~/python$ cd managing-python-packages-virtual-environments/ [username]:~/python/managing-python-packages-virtual-environments$ ls 02 03 04 05 demos [username]:~/python/managing-python-packages-virtual-environments$ cd 02 -bash: cd: 02: Permission denied [username]:~/python/managing-python-packages-virtual-environments$ ls -l total 0 d--------- 1 panxi panxi 512 Aug 20 2021 02 d--------- 1 panxi panxi 512 Aug 20 2021 03 d--------- 1 panxi panxi 512 Aug 20 2021 04 d--------- 1 panxi panxi 512 Aug 20 2021 05 d--------- 1 panxi panxi 512 Aug 20 2021 demos [username]:~/python/managing-python-packages-virtual-environments$ chmod u+rwxr,g+rwxr 02 [username]:~/python/managing-python-packages-virtual-environments$ ls -l total 0 drwxrwx--- 1 panxi panxi 512 Aug 20 2021 02 d--------- 1 panxi panxi 512 Aug 20 2021 03 d--------- 1 panxi panxi 512 Aug 20 2021 04 d--------- 1 panxi panxi 512 Aug 20 2021 05 d--------- 1 panxi panxi 512 Aug 20 2021 demos [username]:~/python/managing-python-packages-virtual-environments$ cd 02 [username]:~/python/managing-python-packages-virtual-environments/02$ ls demos managing-python-packages-with-pip-slides.pdf [username]:~/python/managing-python-packages-virtual-environments/02$ cd demos/ -bash: cd: demos/: Permission denied [username]:~/python/managing-python-packages-virtual-environments/02$ chmod u+rwxr,g+rwxr demos/ [username]:~/python/managing-python-packages-virtual-environments/02$ ls demos managing-python-packages-with-pip-slides.pdf [username]:~/python/managing-python-packages-virtual-environments/02$ cd demos/ [username]:~/python/managing-python-packages-virtual-environments/02/demos$ ls -l total 0 d--------- 1 panxi panxi 512 Dec 28 2018 m2_pip [username]:~/python/managing-python-packages-virtual-environments/02/demos$ cd m2_pip/ -bash: cd: m2_pip/: Permission denied [username]:~/python/managing-python-packages-virtual-environments/02/demos$ chmod u+rwxr,g+rwxr m2_pip/ [username]:~/python/managing-python-packages-virtual-environments/02/demos$ cd m2_pip/ [username]:~/python/managing-python-packages-virtual-environments/02/demos/m2_pip$ ls get_rates.py [username]:~/python/managing-python-packages-virtual-environments/02/demos/m2_pip$ ls -l total 0 ---------- 1 panxi panxi 121 Dec 28 2018 get_rates.py [username]:~/python/managing-python-packages-virtual-environments/02/demos/m2_pip$ chmod u+rwxr,g+rwxr get_rates.py [username]:~/python/managing-python-packages-virtual-environments/02/demos/m2_pip$ py -V Command 'py' not found, but can be installed with: sudo apt install pythonpy [username]:~/python/managing-python-packages-virtual-environments/02/demos/m2_pip$ python -V Command 'python' not found, did you mean: command 'python3' from deb python3 command 'python' from deb python-is-python3 [username]:~/python/managing-python-packages-virtual-environments/02/demos/m2_pip$ python3 -V Python 3.8.10 [username]:~/python/managing-python-packages-virtual-environments/02/demos/m2_pip$ python3 get_rates.py { "success": false, "error": { "code": 101, "type": "missing_access_key", "info": "You have not supplied an API Access Key. [Required format: access_key=YOUR_ACCESS_KEY]" } } [username]:~/python/managing-python-packages-virtual-environments/02/demos/m2_pip$ cat get_rates.py import requests response = requests.get( "https://api.exchangeratesapi.io/latest?symbols=USD") print(response.text) [username]:~/python/managing-python-packages-virtual-environments/02/demos/m2_pip$ cd ../.. [username]:~/python/managing-python-packages-virtual-environments/02$ cd .. [username]:~/python/managing-python-packages-virtual-environments$ chmod --help Usage: chmod [OPTION]... MODE[,MODE]... FILE... or: chmod [OPTION]... OCTAL-MODE FILE... or: chmod [OPTION]... --reference=RFILE FILE... Change the mode of each FILE to MODE. With --reference, change the mode of each FILE to that of RFILE. -c, --changes like verbose but report only when a change is made -f, --silent, --quiet suppress most error messages -v, --verbose output a diagnostic for every file processed --no-preserve-root do not treat '/' specially (the default) --preserve-root fail to operate recursively on '/' --reference=RFILE use RFILE's mode instead of MODE values -R, --recursive change files and directories recursively --help display this help and exit --version output version information and exit Each MODE is of the form '[ugoa]*([-+=]([rwxXst]*|[ugo]))+|[-+=][0-7]+'. GNU coreutils online help: <https://www.gnu.org/software/coreutils/> Report chmod translation bugs to <https://translationproject.org/team/> Full documentation at: <https://www.gnu.org/software/coreutils/chmod> or available locally via: info '(coreutils) chmod invocation' [username]:~/python/managing-python-packages-virtual-environments$ cd .. [username]:~/python$ chmod -R u+rwxr,g+rwxr managing-python-packages-virtual-environments [username]:~/python$ cd managing-python-packages-virtual-environments/ [username]:~/python/managing-python-packages-virtual-environments$ ls 02 03 04 05 demos [username]:~/python/managing-python-packages-virtual-environments$ cd demos/ [username]:~/python/managing-python-packages-virtual-environments/demos$ ls babel_demo.py [username]:~/python/managing-python-packages-virtual-environments/demos$ python3 babel_demo.py In the Netherlands we write 12,345,678 as 12.345.678 [username]:~/python/managing-python-packages-virtual-environments/demos$ cat babel_demo.py from babel.numbers import format_number number = 12345678 print("In the Netherlands we write", format_number(number, locale="en_US"), "as", format_number(number, locale="nl_NL")) [username]:~/python/managing-python-packages-virtual-environments/demos$
pip installed package location: how to find it:
[user]:~/python/managing-python-packages-virtual-environments/demos$ cat babel_demo.py from babel.numbers import format_number number = 12345678 print("In the Netherlands we write", format_number(number, locale="en_US"), "as", format_number(number, locale="nl_NL")) [user]:~/python/managing-python-packages-virtual-environments/demos$ ls babel_demo.py [user]:~/python/managing-python-packages-virtual-environments/demos$ python Command 'python' not found, did you mean: command 'python3' from deb python3 command 'python' from deb python-is-python3 [user]:~/python/managing-python-packages-virtual-environments/demos$ python3 Python 3.8.10 (default, Nov 14 2022, 12:59:47) [GCC 9.4.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import sys >>> sys.path ['', '/usr/lib/python38.zip', '/usr/lib/python3.8', '/usr/lib/python3.8/lib-dynload', '/home/panxi/.local/lib/python3.8/site-packages', '/usr/local/lib/python3.8/dist-packages', '/usr/lib/python3/dist-packages'] >>> KeyboardInterrupt >>> exit Use exit() or Ctrl-D (i.e. EOF) to exit >>> [user]:~/python/managing-python-packages-virtual-environments/demos$ pip show babel Name: Babel Version: 2.11.0 Summary: Internationalization utilities Home-page: https://babel.pocoo.org/ Author: Armin Ronacher Author-email: armin.ronacher@active-4.com License: BSD Location: /home/panxi/.local/lib/python3.8/site-packages Requires: pytz Required-by:
install package by pip better specify the python version: to install package at the target location if you have multi python in you system
[user]:~/python/managing-python-packages-virtual-environments/demos$ pip install --upgrade pip Defaulting to user installation because normal site-packages is not writeable Requirement already satisfied: pip in /home/panxi/.local/lib/python3.8/site-packages (22.3.1) Collecting pip Downloading pip-23.0-py3-none-any.whl (2.1 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.1/2.1 MB 3.4 MB/s eta 0:00:00 Installing collected packages: pip Attempting uninstall: pip Found existing installation: pip 22.3.1 Uninstalling pip-22.3.1: Successfully uninstalled pip-22.3.1 Successfully installed pip-23.0 [user]:~/python/managing-python-packages-virtual-environments/demos$ pip show pip Name: pip Version: 23.0 Summary: The PyPA recommended tool for installing Python packages. Home-page: https://pip.pypa.io/ Author: The pip developers Author-email: distutils-sig@python.org License: MIT Location: /home/panxi/.local/lib/python3.8/site-packages Requires: Required-by: [user]:~/python/managing-python-packages-virtual-environments/demos$ pip install babel Defaulting to user installation because normal site-packages is not writeable Requirement already satisfied: babel in /home/panxi/.local/lib/python3.8/site-packages (2.11.0) Requirement already satisfied: pytz>=2015.7 in /home/panxi/.local/lib/python3.8/site-packages (from babel) (2022.7.1) [user]:~/python/managing-python-packages-virtual-environments/demos$ python -m pip install babel Command 'python' not found, did you mean: command 'python3' from deb python3 command 'python' from deb python-is-python3 [user]:~/python/managing-python-packages-virtual-environments/demos$ python3 -m pip install babel Defaulting to user installation because normal site-packages is not writeable Requirement already satisfied: babel in /home/panxi/.local/lib/python3.8/site-packages (2.11.0) Requirement already satisfied: pytz>=2015.7 in /home/panxi/.local/lib/python3.8/site-packages (from babel) (2022.7.1) [user]:~/python/managing-python-packages-virtual-environments/demos$ python3 Python 3.8.10 (default, Nov 14 2022, 12:59:47) [GCC 9.4.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import sys >>> sys.path ['', '/usr/lib/python38.zip', '/usr/lib/python3.8', '/usr/lib/python3.8/lib-dynload', '/home/panxi/.local/lib/python3.8/site-packages', '/usr/local/lib/python3.8/dist-packages', '/usr/lib/python3/dist-packages'] >>> [user]:~/python/managing-python-packages-virtual-environments/demos$ python3 -m pip install -U babel Defaulting to user installation because normal site-packages is not writeable Requirement already satisfied: babel in /home/panxi/.local/lib/python3.8/site-packages (2.11.0) Requirement already satisfied: pytz>=2015.7 in /home/panxi/.local/lib/python3.8/site-packages (from babel) (2022.7.1) [user]:~/python/managing-python-packages-virtual-environments/demos$ ^C [user]:~/python/managing-python-packages-virtual-environments/demos$
using pip to install package: better using user location than system location to provent system location dirty for all project:
[user]:~/python/managing-python-packages-virtual-environments/demos$ python3 -m pip show babel Name: Babel Version: 2.11.0 Summary: Internationalization utilities Home-page: https://babel.pocoo.org/ Author: Armin Ronacher Author-email: armin.ronacher@active-4.com License: BSD Location: /home/panxi/.local/lib/python3.8/site-packages Requires: pytz Required-by: [user]:~/python/managing-python-packages-virtual-environments/demos$ python3 -m pip install --user babel Requirement already satisfied: babel in /home/panxi/.local/lib/python3.8/site-packages (2.11.0) Requirement already satisfied: pytz>=2015.7 in /home/panxi/.local/lib/python3.8/site-packages (from babel) (2022.7.1) [user]:~/python/managing-python-packages-virtual-environments/demos$
pip install location: from pypi on internet
[user]:~/python/managing-python-packages-virtual-environments/demos$ python3 -m pip help Usage: /usr/bin/python3 -m pip <command> [options] Commands: install Install packages. download Download packages. uninstall Uninstall packages. freeze Output installed packages in requirements format. inspect Inspect the python environment. list List installed packages. show Show information about installed packages. check Verify installed packages have compatible dependencies. config Manage local and global configuration. search Search PyPI for packages. cache Inspect and manage pip's wheel cache. index Inspect information available from package indexes. wheel Build wheels from your requirements. hash Compute hashes of package archives. completion A helper command used for command completion. debug Show information useful for debugging. help Show help for commands. General Options: -h, --help Show help. --debug Let unhandled exceptions propagate outside the main subroutine, instead of logging them to stderr. --isolated Run pip in an isolated mode, ignoring environment variables and user configuration. --require-virtualenv Allow pip to only run in a virtual environment; exit with an error otherwise. --python <python> Run pip with the specified Python interpreter. -v, --verbose Give more output. Option is additive, and can be used up to 3 times. -V, --version Show version and exit. -q, --quiet Give less output. Option is additive, and can be used up to 3 times (corresponding to WARNING, ERROR, and CRITICAL logging levels). --log <path> Path to a verbose appending log. --no-input Disable prompting for input. --proxy <proxy> Specify a proxy in the form scheme://[user:passwd@]proxy.server:port. --retries <retries> Maximum number of retries each connection should attempt (default 5 times). --timeout <sec> Set the socket timeout (default 15 seconds). --exists-action <action> Default action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup, (a)bort. --trusted-host <hostname> Mark this host or host:port pair as trusted, even though it does not have valid or any HTTPS. --cert <path> Path to PEM-encoded CA certificate bundle. If provided, overrides the default. See 'SSL Certificate Verification' in pip documentation for more information. --client-cert <path> Path to SSL client certificate, a single file containing the private key and the certificate in PEM format. --cache-dir <dir> Store the cache data in <dir>. --no-cache-dir Disable the cache. --disable-pip-version-check Don't periodically check PyPI to determine whether a new version of pip is available for download. Implied with --no-index. --no-color Suppress colored output. --no-python-version-warning Silence deprecation warnings for upcoming unsupported Pythons. --use-feature <feature> Enable new functionality, that may be backward incompatible. --use-deprecated <feature> Enable deprecated functionality, that will be removed in the future. [user]:~/python/managing-python-packages-virtual-environments/demos$ python3 -m pip help list Usage: /usr/bin/python3 -m pip list [options] Description: List installed packages, including editables. Packages are listed in a case-insensitive sorted order. List Options: -o, --outdated List outdated packages -u, --uptodate List uptodate packages -e, --editable List editable projects. -l, --local If in a virtualenv that has global access, do not list globally-installed packages. --user Only output packages installed in user-site. --path <path> Restrict to the specified installation path for listing packages (can be used multiple times). --pre Include pre-release and development versions. By default, pip only finds stable versions. --format <list_format> Select the output format among: columns (default), freeze, or json --not-required List packages that are not dependencies of installed packages. --exclude-editable Exclude editable package from output. --include-editable Include editable package from output. --exclude <package> Exclude specified package from the output Package Index Options: -i, --index-url <url> Base URL of the Python Package Index (default https://pypi.org/simple). This should point to a repository compliant with PEP 503 (the simple repository API) or a local directory laid out in the same format. --extra-index-url <url> Extra URLs of package indexes to use in addition to --index-url. Should follow the same rules as --index-url. --no-index Ignore package index (only looking at --find-links URLs instead). -f, --find-links <url> If a URL or path to an html file, then parse for links to archives such as sdist (.tar.gz) or wheel (.whl) files. If a local path or file:// URL that's a directory, then look for archives in the directory listing. Links to VCS project URLs are not supported. General Options: -h, --help Show help. --debug Let unhandled exceptions propagate outside the main subroutine, instead of logging them to stderr. --isolated Run pip in an isolated mode, ignoring environment variables and user configuration. --require-virtualenv Allow pip to only run in a virtual environment; exit with an error otherwise. --python <python> Run pip with the specified Python interpreter. -v, --verbose Give more output. Option is additive, and can be used up to 3 times. -V, --version Show version and exit. -q, --quiet Give less output. Option is additive, and can be used up to 3 times (corresponding to WARNING, ERROR, and CRITICAL logging levels). --log <path> Path to a verbose appending log. --no-input Disable prompting for input. --proxy <proxy> Specify a proxy in the form scheme://[user:passwd@]proxy.server:port. --retries <retries> Maximum number of retries each connection should attempt (default 5 times). --timeout <sec> Set the socket timeout (default 15 seconds). --exists-action <action> Default action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup, (a)bort. --trusted-host <hostname> Mark this host or host:port pair as trusted, even though it does not have valid or any HTTPS. --cert <path> Path to PEM-encoded CA certificate bundle. If provided, overrides the default. See 'SSL Certificate Verification' in pip documentation for more information. --client-cert <path> Path to SSL client certificate, a single file containing the private key and the certificate in PEM format. --cache-dir <dir> Store the cache data in <dir>. --no-cache-dir Disable the cache. --disable-pip-version-check Don't periodically check PyPI to determine whether a new version of pip is available for download. Implied with --no-index. --no-color Suppress colored output. --no-python-version-warning Silence deprecation warnings for upcoming unsupported Pythons. --use-feature <feature> Enable new functionality, that may be backward incompatible. --use-deprecated <feature> Enable deprecated functionality, that will be removed in the future. [user]:~/python/managing-python-packages-virtual-environments/demos$ python3 -m pip list -o Package Version Latest Type ------------------- ------------- --------- ----- attrs 19.3.0 22.2.0 wheel Automat 0.8.0 22.10.0 wheel blinker 1.4 1.5 wheel certifi 2019.11.28 2022.12.7 wheel chardet 3.0.4 5.1.0 wheel Click 7.0 8.1.3 wheel colorama 0.4.3 0.4.6 wheel configobj 5.0.6 5.0.8 wheel cryptography 2.8 39.0.0 wheel dbus-python 1.2.16 1.3.2 sdist distro 1.4.0 1.8.0 wheel distro-info 0.23ubuntu1 1.0 wheel entrypoints 0.3 0.4 wheel httplib2 0.14.0 0.21.0 wheel hyperlink 19.0.0 21.0.0 wheel idna 2.8 3.4 wheel importlib-metadata 1.5.0 6.0.0 wheel incremental 16.10.1 22.10.0 wheel Jinja2 2.10.1 3.1.2 wheel jsonpatch 1.22 1.32 wheel jsonpointer 2.0 2.3 wheel jsonschema 3.2.0 4.17.3 wheel keyring 18.0.1 23.13.1 wheel launchpadlib 1.10.13 1.11.0 wheel lazr.restfulclient 0.14.2 0.14.5 wheel lazr.uri 1.0.3 1.0.6 sdist MarkupSafe 1.1.0 2.1.2 wheel more-itertools 4.2.0 9.0.0 wheel netifaces 0.10.4 0.11.0 wheel numpy 1.22.0 1.24.1 wheel oauthlib 3.1.0 3.2.2 wheel pandas 1.4.0 1.5.3 wheel pexpect 4.6.0 4.8.0 wheel pyasn1 0.4.2 0.4.8 wheel pyasn1-modules 0.2.1 0.2.8 wheel PyGObject 3.36.0 3.42.2 sdist PyHamcrest 1.9.0 2.0.4 wheel PyJWT 1.7.1 2.6.0 wheel PyNaCl 1.3.0 1.5.0 wheel pyOpenSSL 19.0.0 23.0.0 wheel pyrsistent 0.15.5 0.19.3 wheel pyserial 3.4 3.5 wheel python-debian 0.1.36ubuntu1 0.1.49 wheel PyYAML 5.3.1 6.0 wheel requests 2.22.0 2.28.2 wheel requests-unixsocket 0.2.0 0.3.0 wheel SecretStorage 2.3.1 3.3.3 wheel service-identity 18.1.0 21.1.0 wheel setuptools 45.2.0 67.1.0 wheel simplejson 3.16.0 3.18.1 wheel six 1.14.0 1.16.0 wheel ssh-import-id 5.10 5.11 sdist Twisted 18.9.0 22.10.0 wheel urllib3 1.25.8 1.26.14 wheel wadllib 1.3.3 1.3.6 sdist wheel 0.34.2 0.38.4 wheel zipp 1.0.0 3.12.0 wheel zope.interface 4.7.1 5.5.2 wheel [user]:~/python/managing-python-packages-virtual-environments/demos$
course: Managing Python Packages and Virtual Environments | Pluralsight
globally vs user folder