生意兴隆,送台小鸡搞搞活动吧
![0x0208v0 0x0208v0](/assets/uploads/profile/163-profileavatar-1717512470615.png)
0x0208v0
@0x0208v0
-
-
那我得研究研究了,都说warp好,但是自己一直没弄过。据说要注册cf账号?
-
效果图
正文开始
作为MJJ新人、VPS小白,学习Python3之前,你肯定已经有若干个废物小鸡了,
选择一个最烂最便宜的,立刻开始学习Python3叭~
本文以 kuxueyun 的
1.7刀/年,US 洛杉矶 纯IPv6 LXC
小鸡为例
.
.
配置如下:
1核 128MB内存 1G硬盘
.
.第一步,修改系统默认的 /etc/resolv.conf 文件内容(下面的四行命令要一起复制,然后粘贴到控制台,输入回车)
# 命令行直接输入 cat >/etc/resolv.conf <<EOF nameserver 2001:67c:2b0::4 nameserver 2001:67c:2b0::6 EOF
第二步,更新 apt 包管理器的软件索引,并升级软件
# 命令行直接输入 apt update # 此时输出: Hit:1 http://deb.debian.org/debian bookworm InRelease Get:2 http://deb.debian.org/debian bookworm-updates InRelease [55.4 kB] Get:3 http://deb.debian.org/debian-security bookworm-security InRelease [48.0 kB] Get:4 http://deb.debian.org/debian-security bookworm-security/main amd64 Packages [157 kB] Get:5 http://deb.debian.org/debian-security bookworm-security/main Translation-en [93.6 kB] Fetched 354 kB in 2s (194 kB/s) Reading package lists... Done Building dependency tree... Done Reading state information... Done All packages are up to date. # 命令行直接输入 apt upgrade -y # 此时输出: root@la-128-lxc:~# apt upgrade -y Reading package lists... Done Building dependency tree... Done Reading state information... Done Calculating upgrade... Done 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
第三步,安装 Python3
# 命令行直接输入 apt install --no-install-recommends -y python3.11 # 此时输出: root@la-128-lxc:~# apt install -y python3.11 Reading package lists... Done Building dependency tree... Done 0 upgraded, 10 newly installed, 0 to remove and 0 not upgraded. Need to get 7,917 kB of archives. After this operation, 26.6 MB of additional disk space will be used. Get:1 http://deb.debian.org/debian bookworm/main amd64 libpython3.11-minimal amd64 3.11.2-6 [813 kB] Get:2 http://deb.debian.org/debian bookworm/main amd64 python3.11-minimal amd64 3.11.2-6 [2,064 kB] ... ... 省略若干行 ... Processing triggers for ca-certificates (20230311) ... Updating certificates in /etc/ssl/certs... 0 added, 0 removed; done. Running hooks in /etc/ca-certificates/update.d... done.
第四步,安装 Python3 的包管理工具 pip3
# 命令行直接输入 apt install --no-install-recommends -y python3-pip # 此时输出: root@la-128-lxc:~# apt install --no-install-recommends -y python3-pip Reading package lists... Done Building dependency tree... Done Reading state information... Done Get:1 http://deb.debian.org/debian bookworm/main amd64 python3-minimal amd64 3.11.2-1+b1 [26.3 kB] Get:2 http://deb.debian.org/debian bookworm/main amd64 libpython3-stdlib amd64 3.11.2-1+b1 [9,312 B] ... ... 省略若干行 ... Setting up python3-pip (23.0.1+dfsg-1) ... Processing triggers for ca-certificates (20230311) ... Updating certificates in /etc/ssl/certs... 0 added, 0 removed; done. Running hooks in /etc/ca-certificates/update.d... done.
第五步,安装 Python3 虚拟环境管理工具 venv
# 命令行直接输入 apt install --no-install-recommends -y python3.11-venv # 此时输出: root@la-128-lxc:~# apt install --no-install-recommends -y python3.11-venv Reading package lists... Done Building dependency tree... Done Reading state information... Done ... ... 省略若干行 ... Setting up python3.11-venv (3.11.2-6) ...
第六步,创建学习环境 mjj
# 命令行直接输入 python3 -m venv mjj # 创建好以后,我们用ls命令发现当前目录多了一个mjj文件夹 ls -lh # 此时输出: root@la-128-lxc:~# ls -lh total 4.0K drwxr-xr-x 5 root root 4.0K Jun 1 16:17 mjj
第七步,激活学习环境
# 命令行直接输入 source mjj/bin/activate # 此时命令行开头出现(mjj),表示已经成功激活了 root@la-128-lxc:~# source mjj/bin/activate (mjj) root@la-128-lxc:~#
第八步,在学习环境中,安装学习工具 —— ipython
# 命令行直接输入(确保你已经完成了第六步,并且激活了学习环境) pip install ipython # 此时输出: (mjj) root@la-128-lxc:~# pip install ipython Collecting ipython Downloading ipython-8.25.0-py3-none-any.whl (817 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 817.3/817.3 kB 17.7 MB/s eta 0:00:00 ... ... 省略若干行 ... Successfully installed asttokens-2.4.1 decorator-5.1.1 executing-2.0.1 ipython-8.25.0 jedi-0.19.1 matplotlib-inline-0.1.7 parso-0.8.4 pexpect-4.9.0 prompt-toolkit-3.0.45 ptyprocess-0.7.0 pure-eval-0.2.2 pygments-2.18.0 six-1.16.0 stack-data-0.6.3 traitlets-5.14.3 typing-extensions-4.12.0 wcwidth-0.2.13
第九步,进入学习工具 IPython 的 交互界面
# 命令行直接输入 ipython # 此时输出: (mjj) root@la-128-lxc:~# ipython Python 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] Type 'copyright', 'credits' or 'license' for more information IPython 8.25.0 -- An enhanced Interactive Python. Type '?' for help. In [1]:
第十步,学习第一条代码,print,尝试打印字符串 hello mjj
# 命令行直接输入 print('hello mjj') # 此时输出: (mjj) root@la-128-lxc:~# ipython Python 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] Type 'copyright', 'credits' or 'license' for more information IPython 8.25.0 -- An enhanced Interactive Python. Type '?' for help. In [1]: print('hello mjj') hello mjj In [2]: <------- 光标已经定位到这里了,可以接着输别的命令
最后一步,退出ipython环境
# 命令行直接输入 exit() # 此时输出: (mjj) root@la-128-lxc:~# ipython Python 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] Type 'copyright', 'credits' or 'license' for more information IPython 8.25.0 -- An enhanced Interactive Python. Type '?' for help. In [1]: print('hello mjj') hello mjj In [2]: exit() (mjj) root@la-128-lxc:~# <----------- 这里显示已经退回到控制台了
FAQ:如何退出学习环境呢?
# 输入命令 deactivate # 此时输出 (mjj) root@la-128-lxc:~# deactivate root@la-128-lxc:~# <----------- 这里发现(mjj)前缀已经没有了,表示已经成功退出学习环境
-
效果图
正文开始
作为MJJ新人、VPS小白,学习Python3之前,你肯定已经有若干个废物小鸡了,
选择一个最烂最便宜的,立刻开始学习Python3叭~
本文以 duocloud 的
6.99r/年,HK 纯IPv6 LXC
小鸡为例
.
.
配置如下:
1核 1G内存 1G硬盘
.
.第一步,修改系统默认的 /etc/resolv.conf 文件内容(下面的四行命令要一起复制,然后粘贴到控制台,输入回车)
# 命令行直接输入 cat >/etc/resolv.conf <<EOF nameserver 2001:67c:2b0::4 nameserver 2001:67c:2b0::6 EOF
第二步,更新 apk 包管理器的软件索引
# 命令行直接输入 apk update # 此时输出: fetch https://dl-cdn.alpinelinux.org/alpine/v3.19/main/x86_64/APKINDEX.tar.gz fetch https://dl-cdn.alpinelinux.org/alpine/v3.19/community/x86_64/APKINDEX.tar.gz v3.19.1-579-g751a2e41b25 [https://dl-cdn.alpinelinux.org/alpine/v3.19/main] v3.19.1-578-g8b830b8367b [https://dl-cdn.alpinelinux.org/alpine/v3.19/community] OK: 23040 distinct packages available
第三步,安装 Python3
# 命令行直接输入 apk add python3 # 此时输出: hk:~# apk add python3 (1/14) Installing libexpat (2.6.2-r0) ... ... 省略若干行 ... (11/14) Installing python3 (3.11.9-r0) (12/14) Installing python3-pycache-pyc0 (3.11.9-r0) (13/14) Installing pyc (3.11.9-r0) (14/14) Installing python3-pyc (3.11.9-r0) Executing busybox-1.36.1-r15.trigger OK: 97 MiB in 68 packages
第四步,安装 Python3 的包管理工具 pip3
# 命令行直接输入 apk add py3-pip # 此时输出: hk:~# apk add py3-pip (1/8) Installing py3-setuptools-pyc (68.2.2-r0) ... ... 省略若干行 ... (7/8) Installing py3-setuptools (68.2.2-r0) (8/8) Installing py3-pip (23.3.1-r0) Executing busybox-1.36.1-r15.trigger OK: 122 MiB in 76 packages
第五步,创建学习环境 mjj
# 命令行直接输入 python3 -m venv mjj # 创建好以后,我们用ls命令发现当前目录多了一个mjj文件夹 ls -lh # 此时输出: hk:~# ls -lh total 4K drwxr-xr-x 5 root root 4.0K May 31 13:49 mjj
第六步,激活学习环境
# 命令行直接输入 source mjj/bin/activate # 此时命令行开头出现(mjj),表示已经成功激活了 hk:~# source mjj/bin/activate (mjj) hk:~#
第七步,在学习环境中,安装学习工具 —— ipython
# 命令行直接输入(确保你已经完成了第六步,并且激活了学习环境) pip install ipython # 此时输出: (mjj) hk:~# pip install ipython Collecting ipython Using cached ipython-8.25.0-py3-none-any.whl.metadata (4.9 kB) Collecting decorator (from ipython) Using cached decorator-5.1.1-py3-none-any.whl.metadata (4.0 kB) ... ... 省略若干行 ... Collecting jedi>=0.16 (from ipython) Using cached jedi-0.19.1-py2.py3-none-any.whl.metadata (22 kB) Collecting matplotlib-inline (from ipython) Using cached matplotlib_inline-0.1.7-py3-none-any.whl.metadata (3.9 kB) Installing collected packages: wcwidth, pure-eval, ptyprocess, typing-extensions, traitlets, six, pygments, prompt-toolkit, pexpect, parso, executing, decorator, matplotlib-inline, jedi, asttokens, stack-data, ipython Successfully installed asttokens-2.4.1 decorator-5.1.1 executing-2.0.1 ipython-8.25.0 jedi-0.19.1 matplotlib-inline-0.1.7 parso-0.8.4 pexpect-4.9.0 prompt-toolkit-3.0.45 ptyprocess-0.7.0 pure-eval-0.2.2 pygments-2.18.0 six-1.16.0 stack-data-0.6.3 traitlets-5.14.3 typing-extensions-4.12.0 wcwidth-0.2.13
第八步,进入学习工具 IPython 的 交互界面
# 命令行直接输入 ipython # 此时输出: (mjj) hk:~# ipython Python 3.11.9 (main, Apr 14 2024, 13:40:00) [GCC 13.2.1 20231014] Type 'copyright', 'credits' or 'license' for more information IPython 8.25.0 -- An enhanced Interactive Python. Type '?' for help. In [1]:
第九步,学习第一条代码,print,尝试打印字符串 hello mjj
# 命令行直接输入 print('hello mjj') # 此时输出: (mjj) hk:~# ipython Python 3.11.9 (main, Apr 14 2024, 13:40:00) [GCC 13.2.1 20231014] Type 'copyright', 'credits' or 'license' for more information IPython 8.25.0 -- An enhanced Interactive Python. Type '?' for help. In [1]: print('hello mjj') hello mjj In [2]: <------- 光标已经定位到这里了,可以接着输别的命令
最后一步,退出ipython环境
# 命令行直接输入 exit() # 此时输出: (mjj) hk:~# ipython Python 3.11.9 (main, Apr 14 2024, 13:40:00) [GCC 13.2.1 20231014] Type 'copyright', 'credits' or 'license' for more information IPython 8.25.0 -- An enhanced Interactive Python. Type '?' for help. In [1]: print('hello mjj') hello mjj In [2]: exit() (mjj) hk:~# <----------- 这里显示已经退回到控制台了
FAQ:如何退出学习环境呢?
# 输入命令 deactivate # 此时输出 (mjj) hk:~# deactivate hk:~# <----------- 这里发现(mjj)前缀已经没有了,表示已经成功退出学习环境
-
@dadada 数据源来自于我
-
如题,
帮助清理不和谐帖子,包括但不限于恶意贴,骗人贴,见证贴
希望予以通过
感谢
AIKVM智能云 韩国、香港、日本、新加坡、美国 CN2GIA VPS五折
【MJJ新人VPS小白的Python入门指南】以 Debian 系统为例,纯IPv6,安装Python3环境
【MJJ新人VPS小白的Python入门指南】以 Debian 系统为例,纯IPv6,安装Python3环境
【MJJ新人VPS小白的Python入门指南】以 Alpine 系统为例,纯IPv6,安装Python3环境
来了来了,发一个有趣的探针项目,随机探针,聚合了一百多个大牛的探针
本人24小时在线,公平公正MJJ,申请管理员, 望通过