首页 > 系统相关 >安装 python in Linux: Ubuntu at WSL on windows

安装 python in Linux: Ubuntu at WSL on windows

时间:2023-01-20 22:55:18浏览次数:76  
标签:... amd64 panxi python Linux WSL ubuntu 20.04

 

 安装 ubuntu 20.04

app store 安装ubuntu

安装异常:https://thegeekpage.com/wslregisterdistribution-failed-with-error-0x8007019e/

 

 

 

 

安装python 3.8.10

panxi@SLB-3D05SQ3:~$ sudo apt-get update
[sudo] password for panxi:
Hit:1 http://security.ubuntu.com/ubuntu focal-security InRelease
Hit:2 http://archive.ubuntu.com/ubuntu focal InRelease
Hit:3 http://archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:4 http://archive.ubuntu.com/ubuntu focal-backports InRelease
Reading package lists... Done
panxi@SLB-3D05SQ3:~$ sudo apt-get install python3.8
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  libpython3.8 libpython3.8-minimal libpython3.8-stdlib python3.8-minimal
Suggested packages:
  python3.8-venv python3.8-doc binutils binfmt-support
The following packages will be upgraded:
  libpython3.8 libpython3.8-minimal libpython3.8-stdlib python3.8 python3.8-minimal
5 upgraded, 0 newly installed, 0 to remove and 170 not upgraded.
Need to get 6304 kB of archives.
After this operation, 5120 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libpython3.8 amd64 3.8.10-0ubuntu1~20.04.6 [1625 kB]
Get:2 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 python3.8 amd64 3.8.10-0ubuntu1~20.04.6 [387 kB]
Get:3 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libpython3.8-stdlib amd64 3.8.10-0ubuntu1~20.04.6 [1675 kB]
Get:4 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 python3.8-minimal amd64 3.8.10-0ubuntu1~20.04.6 [1901 kB]
Get:5 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libpython3.8-minimal amd64 3.8.10-0ubuntu1~20.04.6 [717 kB]
Fetched 6304 kB in 29s (214 kB/s)
(Reading database ... 32289 files and directories currently installed.)
Preparing to unpack .../libpython3.8_3.8.10-0ubuntu1~20.04.6_amd64.deb ...
Unpacking libpython3.8:amd64 (3.8.10-0ubuntu1~20.04.6) over (3.8.10-0ubuntu1~20.04.2) ...
Preparing to unpack .../python3.8_3.8.10-0ubuntu1~20.04.6_amd64.deb ...
Unpacking python3.8 (3.8.10-0ubuntu1~20.04.6) over (3.8.10-0ubuntu1~20.04.2) ...
Preparing to unpack .../libpython3.8-stdlib_3.8.10-0ubuntu1~20.04.6_amd64.deb ...
Unpacking libpython3.8-stdlib:amd64 (3.8.10-0ubuntu1~20.04.6) over (3.8.10-0ubuntu1~20.04.2) ...
Preparing to unpack .../python3.8-minimal_3.8.10-0ubuntu1~20.04.6_amd64.deb ...
Unpacking python3.8-minimal (3.8.10-0ubuntu1~20.04.6) over (3.8.10-0ubuntu1~20.04.2) ...
Preparing to unpack .../libpython3.8-minimal_3.8.10-0ubuntu1~20.04.6_amd64.deb ...
Unpacking libpython3.8-minimal:amd64 (3.8.10-0ubuntu1~20.04.6) over (3.8.10-0ubuntu1~20.04.2) ...
Setting up libpython3.8-minimal:amd64 (3.8.10-0ubuntu1~20.04.6) ...
Setting up python3.8-minimal (3.8.10-0ubuntu1~20.04.6) ...
Setting up libpython3.8-stdlib:amd64 (3.8.10-0ubuntu1~20.04.6) ...
Setting up python3.8 (3.8.10-0ubuntu1~20.04.6) ...
Setting up libpython3.8:amd64 (3.8.10-0ubuntu1~20.04.6) ...
Processing triggers for libc-bin (2.31-0ubuntu9.2) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for mime-support (3.64ubuntu1) ...
panxi@SLB-3D05SQ3:~$ py --version

Command 'py' not found, but can be installed with:

sudo apt install pythonpy

panxi@SLB-3D05SQ3:~$ python --help

Command 'python' not found, did you mean:

  command 'python3' from deb python3
  command 'python' from deb python-is-python3

panxi@SLB-3D05SQ3:~$ python3 --help
usage: python3 [option] ... [-c cmd | -m mod | file | -] [arg] ...
Options and arguments (and corresponding environment variables):
-b     : issue warnings about str(bytes_instance), str(bytearray_instance)
         and comparing bytes/bytearray with str. (-bb: issue errors)
-B     : don't write .pyc files on import; also PYTHONDONTWRITEBYTECODE=x
-c cmd : program passed in as string (terminates option list)
-d     : debug output from parser; also PYTHONDEBUG=x
-E     : ignore PYTHON* environment variables (such as PYTHONPATH)
-h     : print this help message and exit (also --help)
-i     : inspect interactively after running script; forces a prompt even
         if stdin does not appear to be a terminal; also PYTHONINSPECT=x
-I     : isolate Python from the user's environment (implies -E and -s)
-m mod : run library module as a script (terminates option list)
-O     : remove assert and __debug__-dependent statements; add .opt-1 before
         .pyc extension; also PYTHONOPTIMIZE=x
-OO    : do -O changes and also discard docstrings; add .opt-2 before
         .pyc extension
-q     : don't print version and copyright messages on interactive startup
-s     : don't add user site directory to sys.path; also PYTHONNOUSERSITE
-S     : don't imply 'import site' on initialization
-u     : force the stdout and stderr streams to be unbuffered;
         this option has no effect on stdin; also PYTHONUNBUFFERED=x
-v     : verbose (trace import statements); also PYTHONVERBOSE=x
         can be supplied multiple times to increase verbosity
-V     : print the Python version number and exit (also --version)
         when given twice, print more information about the build
-W arg : warning control; arg is action:message:category:module:lineno
         also PYTHONWARNINGS=arg
-x     : skip first line of source, allowing use of non-Unix forms of #!cmd
-X opt : set implementation-specific option. The following options are available:

         -X faulthandler: enable faulthandler
         -X showrefcount: output the total reference count and number of used
             memory blocks when the program finishes or after each statement in the
             interactive interpreter. This only works on debug builds
         -X tracemalloc: start tracing Python memory allocations using the
             tracemalloc module. By default, only the most recent frame is stored in a
             traceback of a trace. Use -X tracemalloc=NFRAME to start tracing with a
             traceback limit of NFRAME frames
         -X showalloccount: output the total count of allocated objects for each
             type when the program finishes. This only works when Python was built with
             COUNT_ALLOCS defined
         -X importtime: show how long each import takes. It shows module name,
             cumulative time (including nested imports) and self time (excluding
             nested imports). Note that its output may be broken in multi-threaded
             application. Typical usage is python3 -X importtime -c 'import asyncio'
         -X dev: enable CPython's "development mode", introducing additional runtime
             checks which are too expensive to be enabled by default. Effect of the
             developer mode:
                * Add default warning filter, as -W default
                * Install debug hooks on memory allocators: see the PyMem_SetupDebugHooks() C function
                * Enable the faulthandler module to dump the Python traceback on a crash
                * Enable asyncio debug mode
                * Set the dev_mode attribute of sys.flags to True
                * io.IOBase destructor logs close() exceptions
         -X utf8: enable UTF-8 mode for operating system interfaces, overriding the default
             locale-aware mode. -X utf8=0 explicitly disables UTF-8 mode (even when it would
             otherwise activate automatically)
         -X pycache_prefix=PATH: enable writing .pyc files to a parallel tree rooted at the
             given directory instead of to the code tree

--check-hash-based-pycs always|default|never:
    control how Python invalidates hash-based .pyc files
file   : program read from script file
-      : program read from stdin (default; interactive mode if a tty)
arg ...: arguments passed to program in sys.argv[1:]

Other environment variables:
PYTHONSTARTUP: file executed on interactive startup (no default)
PYTHONPATH   : ':'-separated list of directories prefixed to the
               default module search path.  The result is sys.path.
PYTHONHOME   : alternate <prefix> directory (or <prefix>:<exec_prefix>).
               The default module search path uses <prefix>/lib/pythonX.X.
PYTHONCASEOK : ignore case in 'import' statements (Windows).
PYTHONUTF8: if set to 1, enable the UTF-8 mode.
PYTHONIOENCODING: Encoding[:errors] used for stdin/stdout/stderr.
PYTHONFAULTHANDLER: dump the Python traceback on fatal errors.
PYTHONHASHSEED: if this variable is set to 'random', a random value is used
   to seed the hashes of str and bytes objects.  It can also be set to an
   integer in the range [0,4294967295] to get hash values with a
   predictable seed.
PYTHONMALLOC: set the Python memory allocators and/or install debug hooks
   on Python memory allocators. Use PYTHONMALLOC=debug to install debug
   hooks.
PYTHONCOERCECLOCALE: if this variable is set to 0, it disables the locale
   coercion behavior. Use PYTHONCOERCECLOCALE=warn to request display of
   locale coercion and locale compatibility warnings on stderr.
PYTHONBREAKPOINT: if this variable is set to 0, it disables the default
   debugger. It can be set to the callable of your debugger of choice.
PYTHONDEVMODE: enable the development mode.
PYTHONPYCACHEPREFIX: root directory for bytecode cache (pyc) files.
panxi@SLB-3D05SQ3:~$ python3 --version
Python 3.8.10
panxi@SLB-3D05SQ3:~$

  

安装 pip

panxi@SLB-3D05SQ3:~$ apt install python3-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?
panxi@SLB-3D05SQ3:~$ sudo apt install python3-pip
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  binutils binutils-common binutils-x86-64-linux-gnu build-essential cpp cpp-9 dpkg-dev fakeroot g++ g++-9 gcc gcc-9
  gcc-9-base libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl libasan5 libatomic1 libbinutils
  libc-dev-bin libc6 libc6-dev libcc1-0 libcrypt-dev libctf-nobfd0 libctf0 libdpkg-perl libexpat1 libexpat1-dev
  libfakeroot libfile-fcntllock-perl libgcc-9-dev libgomp1 libisl22 libitm1 liblsan0 libmpc3 libpython3-dev
  libpython3.8-dev libquadmath0 libstdc++-9-dev libtsan0 libubsan1 linux-libc-dev make manpages-dev python-pip-whl
  python3-dev python3-wheel python3.8-dev zlib1g zlib1g-dev
Suggested packages:
  binutils-doc cpp-doc gcc-9-locales debian-keyring g++-multilib g++-9-multilib gcc-9-doc gcc-multilib autoconf
  automake libtool flex bison gdb gcc-doc gcc-9-multilib glibc-doc bzr libstdc++-9-doc make-doc
The following NEW packages will be installed:
  binutils binutils-common binutils-x86-64-linux-gnu build-essential cpp cpp-9 dpkg-dev fakeroot g++ g++-9 gcc gcc-9
  gcc-9-base libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl libasan5 libatomic1 libbinutils
  libc-dev-bin libc6-dev libcc1-0 libcrypt-dev libctf-nobfd0 libctf0 libdpkg-perl libexpat1-dev libfakeroot
  libfile-fcntllock-perl libgcc-9-dev libgomp1 libisl22 libitm1 liblsan0 libmpc3 libpython3-dev libpython3.8-dev
  libquadmath0 libstdc++-9-dev libtsan0 libubsan1 linux-libc-dev make manpages-dev python-pip-whl python3-dev
  python3-pip python3-wheel python3.8-dev zlib1g-dev
The following packages will be upgraded:
  libc6 libexpat1 zlib1g
3 upgraded, 50 newly installed, 0 to remove and 167 not upgraded.
Need to get 55.1 MB of archives.
After this operation, 228 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libc6 amd64 2.31-0ubuntu9.9 [2722 kB]
Get:2 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 zlib1g amd64 1:1.2.11.dfsg-2ubuntu1.5 [54.2 kB]
Get:3 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libexpat1 amd64 2.2.9-1ubuntu0.6 [74.6 kB]
Get:4 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 binutils-common amd64 2.34-6ubuntu1.4 [207 kB]
Get:5 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libbinutils amd64 2.34-6ubuntu1.4 [474 kB]
Get:6 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libctf-nobfd0 amd64 2.34-6ubuntu1.4 [47.2 kB]
Get:7 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libctf0 amd64 2.34-6ubuntu1.4 [46.6 kB]
Get:8 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 binutils-x86-64-linux-gnu amd64 2.34-6ubuntu1.4 [1613 kB]
Get:9 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 binutils amd64 2.34-6ubuntu1.4 [3380 B]
Get:10 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libc-dev-bin amd64 2.31-0ubuntu9.9 [71.8 kB]
Get:11 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 linux-libc-dev amd64 5.4.0-137.154 [1120 kB]
Get:12 http://archive.ubuntu.com/ubuntu focal/main amd64 libcrypt-dev amd64 1:4.4.10-10ubuntu4 [104 kB]
Get:13 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libc6-dev amd64 2.31-0ubuntu9.9 [2519 kB]
Get:14 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 gcc-9-base amd64 9.4.0-1ubuntu1~20.04.1 [19.4 kB]
Get:15 http://archive.ubuntu.com/ubuntu focal/main amd64 libisl22 amd64 0.22.1-1 [592 kB]
Get:16 http://archive.ubuntu.com/ubuntu focal/main amd64 libmpc3 amd64 1.1.0-1 [40.8 kB]
Get:17 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 cpp-9 amd64 9.4.0-1ubuntu1~20.04.1 [7500 kB]
Get:18 http://archive.ubuntu.com/ubuntu focal/main amd64 cpp amd64 4:9.3.0-1ubuntu2 [27.6 kB]
Get:19 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libcc1-0 amd64 10.3.0-1ubuntu1~20.04 [48.8 kB]
Get:20 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libgomp1 amd64 10.3.0-1ubuntu1~20.04 [102 kB]
Get:21 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libitm1 amd64 10.3.0-1ubuntu1~20.04 [26.2 kB]
Get:22 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libatomic1 amd64 10.3.0-1ubuntu1~20.04 [9284 B]
Get:23 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libasan5 amd64 9.4.0-1ubuntu1~20.04.1 [2751 kB]
Get:24 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 liblsan0 amd64 10.3.0-1ubuntu1~20.04 [835 kB]
Get:25 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libtsan0 amd64 10.3.0-1ubuntu1~20.04 [2009 kB]
Get:26 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libubsan1 amd64 10.3.0-1ubuntu1~20.04 [784 kB]
Get:27 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libquadmath0 amd64 10.3.0-1ubuntu1~20.04 [146 kB]
Get:28 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libgcc-9-dev amd64 9.4.0-1ubuntu1~20.04.1 [2359 kB]
Get:29 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 gcc-9 amd64 9.4.0-1ubuntu1~20.04.1 [8274 kB]
Setting up libcrypt-dev:amd64 (1:4.4.10-10ubuntu4) ...
Setting up libisl22:amd64 (0.22.1-1) ...
Setting up python-pip-whl (20.0.2-5ubuntu1.6) ...
Setting up libbinutils:amd64 (2.34-6ubuntu1.4) ...
Setting up libc-dev-bin (2.31-0ubuntu9.9) ...
Setting up libalgorithm-diff-xs-perl (0.04-6) ...
Setting up libcc1-0:amd64 (10.3.0-1ubuntu1~20.04) ...
Setting up liblsan0:amd64 (10.3.0-1ubuntu1~20.04) ...
Setting up libitm1:amd64 (10.3.0-1ubuntu1~20.04) ...
Setting up gcc-9-base:amd64 (9.4.0-1ubuntu1~20.04.1) ...
Setting up libalgorithm-merge-perl (0.08-3) ...
Setting up libtsan0:amd64 (10.3.0-1ubuntu1~20.04) ...
Setting up libctf0:amd64 (2.34-6ubuntu1.4) ...
Setting up libasan5:amd64 (9.4.0-1ubuntu1~20.04.1) ...
Setting up python3-pip (20.0.2-5ubuntu1.6) ...
Setting up cpp-9 (9.4.0-1ubuntu1~20.04.1) ...
Setting up libc6-dev:amd64 (2.31-0ubuntu9.9) ...
Setting up binutils-x86-64-linux-gnu (2.34-6ubuntu1.4) ...
Setting up binutils (2.34-6ubuntu1.4) ...
Setting up dpkg-dev (1.19.7ubuntu3.2) ...
Setting up libgcc-9-dev:amd64 (9.4.0-1ubuntu1~20.04.1) ...
Setting up libexpat1-dev:amd64 (2.2.9-1ubuntu0.6) ...
Setting up libpython3.8-dev:amd64 (3.8.10-0ubuntu1~20.04.6) ...
Setting up zlib1g-dev:amd64 (1:1.2.11.dfsg-2ubuntu1.5) ...
Setting up cpp (4:9.3.0-1ubuntu2) ...
Setting up gcc-9 (9.4.0-1ubuntu1~20.04.1) ...
Setting up libpython3-dev:amd64 (3.8.2-0ubuntu2) ...
Setting up libstdc++-9-dev:amd64 (9.4.0-1ubuntu1~20.04.1) ...
Setting up gcc (4:9.3.0-1ubuntu2) ...
Setting up g++-9 (9.4.0-1ubuntu1~20.04.1) ...
Setting up python3.8-dev (3.8.10-0ubuntu1~20.04.6) ...
Setting up g++ (4:9.3.0-1ubuntu2) ...
update-alternatives: using /usr/bin/g++ to provide /usr/bin/c++ (c++) in auto mode
Setting up build-essential (12.8ubuntu1.1) ...
Setting up python3-dev (3.8.2-0ubuntu2) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for libc-bin (2.31-0ubuntu9.2) ...
panxi@SLB-3D05SQ3:~$

  

download module

panxi@SLB-3D05SQ3:~$ pip --version
pip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.8)
panxi@SLB-3D05SQ3:~$ pip install numpy==1.22
Collecting numpy==1.22
  Downloading numpy-1.22.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (16.8 MB)
     |████████████████████████████████| 16.8 MB 24 kB/s
Installing collected packages: numpy
  WARNING: The scripts f2py, f2py3 and f2py3.8 are installed in '/home/panxi/.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 numpy-1.22.0
panxi@SLB-3D05SQ3:~$ pip install pandas==1.4
Collecting pandas==1.4
  Downloading pandas-1.4.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (11.7 MB)
     |████████████████████████████████| 11.7 MB 40 kB/s
Requirement already satisfied: numpy>=1.18.5; platform_machine != "aarch64" and platform_machine != "arm64" and python_version < "3.10" in ./.local/lib/python3.8/site-packages (from pandas==1.4) (1.22.0)
Collecting pytz>=2020.1
  Downloading pytz-2022.7.1-py2.py3-none-any.whl (499 kB)
     |████████████████████████████████| 499 kB 16 kB/s
Collecting python-dateutil>=2.8.1
  Downloading python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB)
     |████████████████████████████████| 247 kB 14 kB/s
Requirement already satisfied: six>=1.5 in /usr/lib/python3/dist-packages (from python-dateutil>=2.8.1->pandas==1.4) (1.14.0)
Installing collected packages: pytz, python-dateutil, pandas
Successfully installed pandas-1.4.0 python-dateutil-2.8.2 pytz-2022.7.1

  

panxi@SLB-3D05SQ3:~$ python3 -m pip install --upgrade pip
Collecting pip
  Downloading pip-22.3.1-py3-none-any.whl (2.1 MB)
     |████████████████████████████████| 2.1 MB 8.9 kB/s
Installing collected packages: pip
  WARNING: The scripts pip, pip3, pip3.10 and pip3.8 are installed in '/home/panxi/.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 pip-22.3.1
panxi@SLB-3D05SQ3:~$

  

 

panxi@SLB-3D05SQ3:~$ 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                    20.0.2
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
panxi@SLB-3D05SQ3:~$

  

添加 虚拟环境,并激活

panxi@SLB-3D05SQ3:~$ ls
panxi@SLB-3D05SQ3:~$ cd ../
panxi@SLB-3D05SQ3:/home$ ls
panxi
panxi@SLB-3D05SQ3:/home$ cd panxi/
panxi@SLB-3D05SQ3:~$ ls
panxi@SLB-3D05SQ3:~$ mkdir python
panxi@SLB-3D05SQ3:~$ ls
Command 'py' not found, but can be installed with:

sudo apt install pythonpy

panxi@SLB-3D05SQ3:~/python/panTestProjects$ python3 -m venv py3_8_numpy1_22_pandas1_4
The virtual environment was not created successfully because ensurepip is not
available.  On Debian/Ubuntu systems, you need to install the python3-venv
package using the following command.

    apt install python3.8-venv

You may need to use sudo with that command.  After installing the python3-venv
package, recreate your virtual environment.

Failing command: ['/home/panxi/python/panTestProjects/py3_8_numpy1_22_pandas1_4/bin/python3', '-Im', 'ensurepip', '--upgrade', '--default-pip']

panxi@SLB-3D05SQ3:~/python/panTestProjects$ apt install python3.8-venv
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?
panxi@SLB-3D05SQ3:~/python/panTestProjects$ sudo apt install python3.8-venv
[sudo] password for panxi:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  python3.8-venv
0 upgraded, 1 newly installed, 0 to remove and 167 not upgraded.
Need to get 5448 B of archives.
After this operation, 27.6 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 python3.8-venv amd64 3.8.10-0ubuntu1~20.04.6 [5448 B]
Fetched 5448 B in 1s (4048 B/s)
Selecting previously unselected package python3.8-venv.
(Reading database ... 38402 files and directories currently installed.)
Preparing to unpack .../python3.8-venv_3.8.10-0ubuntu1~20.04.6_amd64.deb ...
Unpacking python3.8-venv (3.8.10-0ubuntu1~20.04.6) ...
Setting up python3.8-venv (3.8.10-0ubuntu1~20.04.6) ...
panxi@SLB-3D05SQ3:~/python/panTestProjects$ python3 -m venv py3_8_numpy1_22_pandas1_4
panxi@SLB-3D05SQ3:~/python/panTestProjects$ ls
py3_8_numpy1_22_pandas1_4
panxi@SLB-3D05SQ3:~/python/panTestProjects$ cd py3_8_numpy1_22_pandas1_4/
panxi@SLB-3D05SQ3:~/python/panTestProjects/py3_8_numpy1_22_pandas1_4$ ls
bin  include  lib  lib64  pyvenv.cfg  share
panxi@SLB-3D05SQ3:~/python/panTestProjects/py3_8_numpy1_22_pandas1_4$ cd bin/
panxi@SLB-3D05SQ3:~/python/panTestProjects/py3_8_numpy1_22_pandas1_4/bin$ ls
Activate.ps1  activate  activate.csh  activate.fish  easy_install  easy_install-3.8  pip  pip3  pip3.8  python  python3
panxi@SLB-3D05SQ3:~/python/panTestProjects/py3_8_numpy1_22_pandas1_4/bin$ activate
activate: command not found
panxi@SLB-3D05SQ3:~/python/panTestProjects/py3_8_numpy1_22_pandas1_4/bin$ activcate
activcate: command not found
panxi@SLB-3D05SQ3:~/python/panTestProjects/py3_8_numpy1_22_pandas1_4/bin$ activate
activate: command not found
panxi@SLB-3D05SQ3:~/python/panTestProjects/py3_8_numpy1_22_pandas1_4/bin$  activate
activate: command not found
panxi@SLB-3D05SQ3:~/python/panTestProjects/py3_8_numpy1_22_pandas1_4/bin$ source activate
(py3_8_numpy1_22_pandas1_4) panxi@SLB-3D05SQ3:~/python/panTestProjects/py3_8_numpy1_22_pandas1_4/bin$

  

 

 

虚拟空间 安装 安装包

panxi@SLB-3D05SQ3:~/python/panTestProjects/py3_8_numpy1_22_pandas1_4/bin$ source activate
(py3_8_numpy1_22_pandas1_4) panxi@SLB-3D05SQ3:~/python/panTestProjects/py3_8_numpy1_22_pandas1_4/bin$ pip install numpy==1.22
Collecting numpy==1.22
  Using cached numpy-1.22.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (16.8 MB)
Installing collected packages: numpy
Successfully installed numpy-1.22.0
(py3_8_numpy1_22_pandas1_4) panxi@SLB-3D05SQ3:~/python/panTestProjects/py3_8_numpy1_22_pandas1_4/bin$ pip install pandas==1.4
Collecting pandas==1.4
  Using cached pandas-1.4.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (11.7 MB)
Requirement already satisfied: numpy>=1.18.5; platform_machine != "aarch64" and platform_machine != "arm64" and python_version < "3.10" in /home/panxi/python/panTestProjects/py3_8_numpy1_22_pandas1_4/lib/python3.8/site-packages (from pandas==1.4) (1.22.0)
Collecting pytz>=2020.1
  Using cached pytz-2022.7.1-py2.py3-none-any.whl (499 kB)
Collecting python-dateutil>=2.8.1
  Using cached python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB)
Collecting six>=1.5
  Downloading six-1.16.0-py2.py3-none-any.whl (11 kB)
Installing collected packages: pytz, six, python-dateutil, pandas
Successfully installed pandas-1.4.0 python-dateutil-2.8.2 pytz-2022.7.1 six-1.16.0
(py3_8_numpy1_22_pandas1_4) panxi@SLB-3D05SQ3:~/python/panTestProjects/py3_8_numpy1_22_pandas1_4/bin$

  

(py3_8_numpy1_22_pandas1_4) panxi@SLB-3D05SQ3:~/python/panTestProjects/py3_8_numpy1_22_pandas1_4/bin$ pip list
Package         Version
--------------- --------
numpy           1.22.0
pandas          1.4.0
pip             20.0.2
pkg-resources   0.0.0
python-dateutil 2.8.2
pytz            2022.7.1
setuptools      44.0.0
six             1.16.0

  

关闭 激活的虚拟空间:

(py3_8_numpy1_22_pandas1_4) panxi@SLB-3D05SQ3:~/python/panTestProjects/py3_8_numpy1_22_pandas1_4/bin$ ls
Activate.ps1  activate.csh   easy_install      f2py   f2py3.8  pip3    python
activate      activate.fish  easy_install-3.8  f2py3  pip      pip3.8  python3
(py3_8_numpy1_22_pandas1_4) panxi@SLB-3D05SQ3:~/python/panTestProjects/py3_8_numpy1_22_pandas1_4/bin$ cd..
cd..: command not found
(py3_8_numpy1_22_pandas1_4) panxi@SLB-3D05SQ3:~/python/panTestProjects/py3_8_numpy1_22_pandas1_4/bin$ cd ..
(py3_8_numpy1_22_pandas1_4) panxi@SLB-3D05SQ3:~/python/panTestProjects/py3_8_numpy1_22_pandas1_4$ deactivate
panxi@SLB-3D05SQ3:~/python/panTestProjects/py3_8_numpy1_22_pandas1_4$

  

 

标签:...,amd64,panxi,python,Linux,WSL,ubuntu,20.04
From: https://www.cnblogs.com/panpanwelcome/p/17063368.html

相关文章

  • WSL中使用vcpkg安装pcl库出现编译失败的原因
    在wsl使用vcpkginstallpcl安装时,出现了BUILD_FAILED失败提示,查看log文件出现如下的错误:compilationproblem,c++:internalcompilererror:Killed(programcc1......
  • Python入门之数据类型转换
    """数据类型转换运算符算数运算符增强运算符"""#1.数据类型转换#intfloatstrstr_usb=input("请输入美元:")#类型转换str-->intin......
  • Python入门之数据类型
    """核心数据类型"""#1.Nonea01="张无忌"#接触变量与数据的绑定关系a01=None#使用None占位sex=None流程图:   #2.整形int#十进制nu......
  • Python 永久换源
    Python永久换源pipconfigsetglobal.index-urlhttps://pypi.douban.com/simple源地址:#腾讯http://mirrors.tencentyun.com/pypi/simple#阿里https://mirrors......
  • Linux中安装MySQL
    1.卸载系统自带的mariadb我这里使用的是Centos7,所以系统会自带Mariadb,需要先卸载掉,当然后面在安装mysql的过程中也会有提示查询已安装的Mariadb安装包:rpm-qa|......
  • 利用艾宾浩斯曲线生成单词背诵规划表——python
    利用艾宾浩斯遗忘曲线生成单词背诵计划表#以下代码根据需背诵list总数(listcount)、复习间隔天数(days)#来自动生成单词背诵规划表,包括背诵周期、某天应学习复习list。#......
  • 【python】pandas库学习笔记
    北京理工大学嵩天Pandas课程学习笔记。部分内容补充自菜鸟教程。Pandas库提供了共性能易用数据类型和分析工具的第三方python库。Pandas库基于Numpy库实现。Pandas......
  • Linux防火墙的使用
    防火墙放行端口kali中需要进行安装(Centos7及之后的版本是自带的,无需安装):sudoaptinstallfirewalld#查看防火墙服务的状态┌──(root㉿kali)-[/home/junlin]└─#......
  • python基础
    字面量被写下来的固定的值,成为字面量常见的6种值数字intfloatcomplex(复数,以j结尾表示复数),bool控制精度m.n m控制宽度(小数点也计入),设置的宽度小于数字自身不生......
  • 一些看起来很酷的Linux命令
    1.sl命令你会看到一辆火车从屏幕右边开往左边……安装$ sudo apt-get install sl运行$ sl命令有-alFe几个选项,-a An accident seems to happen. You'll ......