首页
关于
友链
Search
1
ESXI 一些功能调整
755 阅读
2
SoftEther 客户端篇
665 阅读
3
天翼云网关3.0/4.0超管密码
619 阅读
4
SoftEther 服务端篇
534 阅读
5
Centos安装个人网盘Alist v3教程
507 阅读
奇思妙想
代码相关
软件分享
游戏分享
游戏相关
我的家庭影院
登录
Search
标签搜索
python
git
命令
esxi
SoftEther
linux
apscheduler
在线
ai
list
列表
idm
激活码
Charles
pdf
免安装
鲁大师
图片查看器
蜂蜜浏览器
honeyview
哥特式
累计撰写
116
篇文章
累计收到
15
条评论
首页
栏目
奇思妙想
代码相关
软件分享
游戏分享
游戏相关
我的家庭影院
页面
关于
友链
搜索到
96
篇与
的结果
2024-03-05
Ubuntu系统
1. 开启ipv6编辑ufw文件vi /etc/default/ufw如果IPV6为yes则为开启2. 设置网络信息编辑/etc/netplan/00-installer-config.yaml这个文件network: ethernets: ens160: #dhcp4: true addresses: - 192.168.*/24 nameservers: addresses: - 192.168.* - 192.168.* search: [] routes: - to: default via: 192.168.* version: 2 #renderer: networkd# 应用更改 netplan apply # 查看网关是否修改,第一行default via .... ip route show3. 设置时区dpkg-reconfigure tzdata4. 安装的时候网络选择
2024年03月05日
82 阅读
0 评论
0 点赞
2024-01-30
兰空图床本地上传文件,配合Typora使用
# -*- coding: utf-8 -*- # @Time : 2022-05-18 13:53 # @Author : GeTeShi # @File : test6.py import datetime import time import requests import redis import json import re import os import sys rdb = redis.StrictRedis(host='localhost', port=6379, decode_responses=True) NAME = "test" forever = 60 * 60 * 24 * 30 * 12 * 100 def get_cache(key, name=None): global NAME if name: NAME = name if rdb.hlen(name) and rdb.hexists(name, key): res = rdb.hget(NAME, key) try: res = json.loads(res) except json.decoder.JSONDecodeError: pass return res else: return False def get_cache_all_key(name): global NAME if name: NAME = name if rdb.hlen(name): return rdb.hkeys(name=name) def set_cache(key, content, timeout=60, name=None): global NAME if name: NAME = name if isinstance(content, dict): content = json.dumps(content) rdb.hset(NAME, key, content) rdb.expire(key, timeout) def del_cache(key, name=None): global NAME if name: NAME = name if rdb.hexists(name=name, key=key): rdb.hdel(name, key) def md5(s): import hashlib m2 = hashlib.md5() m2.update(s.encode("utf-8")) return m2.hexdigest() class image_upload(object): def __init__(self, email, password): self.URL = "https://你的图床的api" self.header = { "Accept": "application/json", "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/108.0.0.0 Safari/537.36 Edg/108.0.1462.54 ", } self.email = email self.password = password self.TOKEN_KEY = f"{self.email}_{md5(self.password)}_{datetime.datetime.strftime(datetime.datetime.now(), '%Y%m')}" self.sess = requests.Session() self.sess.get(url="https://你的图床的api") def get_requests(self, url, method, data=None, file=None): if not self.header.get('Authorization') and "tokens" not in url: header = self.header self.login() self.header.update(header) if method == "post": response = self.sess.post(url=url, data=data if data else "", headers=self.header) elif method == "get": response = self.sess.get(url=url, params=data if data else "", headers=self.header) elif method == "upload": response = self.sess.post(url=url, files=file, headers=self.header, data=data) else: response = self.sess.delete(url=url, headers=self.header) if response.status_code == 200: response.encoding = "utf-8" response = response.json() return response def get_token(self): self.header = {"Accept": "application/json"} token = self.get_requests(url=self.URL + "/tokens", method="post", data={ "email": self.email, "password": self.password }) if token: set_cache(self.TOKEN_KEY, token, timeout=60 * 60 * 24, name="upload-image") return token def upload(self, file): self.header.update({ "Accept": "multipart/form-data" }) filename = file.rsplit("\\", 1)[1].split(".")[0] filetype = file.rsplit("\\", 1)[1].split(".")[1] files = { "file": (f"{filename}.{filetype}", open(file, 'rb'), f"image/{filetype}"), } # 存储策略id,默认1 data = { "strategy_id": 1, } url = self.URL + "/upload" res = self.get_requests(url=url, method="upload", data=data, file=files) if res and res.get("status"): data = res.get('data') print(data.get('links').get('url')) return data.get('links').get('thumbnail_url') else: raise Exception(f"图片上传失败,失败原因:{res.get('message')}") def login(self): token = get_cache(self.TOKEN_KEY, name="upload-image") if (not token) or (not token.get('data') or not token.get('data').get('token')): token = self.get_token() # token = get_cache(self.TOKEN_KEY, name="upload-image") url = self.URL + "/profile" # print(token.get('data')) self.header.update({ "Authorization": "Bearer " + token.get('data').get('token'), "Accept": "application/json" }) self.get_requests(url=url, data="", method="get") def main(self): pass def clear(self): self.get_requests(url=self.URL + "/tokens", data="", method="delete") self.header = {} return "已清空tokens" def get_strategies(self): """获取存储策略""" res = self.get_requests(url=self.URL + "/strategies", method="get") print(res) if __name__ == '__main__': images = sys.argv[1:] for image in images: image_upload(email="你的用户名", password="你的密码").upload(file=image)
2024年01月30日
105 阅读
0 评论
0 点赞
2024-01-29
requestium库的使用
这个Python库把requests按在地上摩擦!在 Python 编程中,处理网络请求是一个常见的任务,特别是做爬虫采集数据。最受欢迎的是 Requests 和 Selenium。而Requestium 结合了这两个库优点的工具,它可以让你在一个统一的接口中使用 Requests 的简便性和 Selenium 的强大功能。1. 安装 Requestium在开始使用 Requestium 之前,你需要先将其安装到你的环境中。安装非常简单,可以通过 pip 命令完成:pip install requestium2. Requestium 的核心功能结合 Requests 和 Selenium: Requestium 将 Requests 库的简易性和 Selenium 库的交互功能结合在了一起。无缝切换: 它允许用户在需要时从 Requests 无缝切换到 Selenium,反之亦然。增强的 XPath 支持: Requestium 提供了对 XPath 的额外支持,使得在使用 Selenium 时可以更方便地定位元素。3. 使用 Requestium 发送请求Requestium 的使用方法与 Requests 类似。以下是一个基本示例,展示如何发送 GET 请求:# 创建一个 Session对象 from requestium import Session # 使用 Requestium 发送 GET 请求 s = Session(webdriver_path='chromedriver', browser='chrome', default_timeout=15) response = s.get('https://www.example.com') print(response.text)4. 结合 Selenium 和 RequestsRequestium 的真正强大之处在于它能够让你在需要时切换到 Selenium。以下是一个示例,展示如何在发送请求后使用 Selenium 处理 JavaScript:from requestium import Session s = Session(webdriver_path='chromedriver', browser='chrome', default_timeout=15) # 发送请求 s.get('https://www.example.com') # 使用 Selenium 处理页面 s.driver.get('https://www.example.com') # 使用 Selenium 定位元素 element = s.driver.find_element_by_xpath('//div[@class="example"]') print(element.text)5. 实战案例假设我们要抓取一个动态加载内容的网页。首先,我们使用 Requestium 发送请求,然后通过 Selenium 处理 JavaScript,最后提取所需数据。from requestium import Session s = Session(webdriver_path='chromedriver', browser='chrome', default_timeout=15) # 访问网页 s.get('https://www.dynamic-content-website.com') # 使用 Selenium 处理动态内容 s.driver.get('https://www.dynamic-content-website.com') # 提取数据 data = s.driver.find_element_by_xpath('//div[@id="dynamic-content"]').text print(data)
2024年01月29日
87 阅读
0 评论
0 点赞
2024-01-29
Nginx配置
自定义返回的东西要在 Nginx 中实现自定义 favicon.ico 返回特定的文件,你可以使用如下的配置:server { listen 80; server_name your_domain.com; location = /favicon.ico { alias /www/favicon.ico; } # 其他服务器配置... }在上面的配置中,当访问 /favicon.ico 路径时,会直接返回 /www/favicon.ico 文件。使用 alias 指令可以让 Nginx 从指定的路径返回文件,而不会将 /favicon.ico 重定向到其他路径。配置完成后,重启 Nginx 以使配置生效。请确保 Nginx 对 /www 目录有读取权限,以便正确返回 favicon.ico 文件。记录日志的格式nginx设置里面,server上面,增加这个log_format http_format '$remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" $host';网站配置里面access_log /www/wwwlogs/域名信息.log http_format;
2024年01月29日
143 阅读
0 评论
0 点赞
2024-01-25
Windows激活
windows激活,office激活终端执行这个irm https://massgrave.dev/get | iex
2024年01月25日
45 阅读
0 评论
0 点赞
2024-01-22
宝塔面板
使用宝塔的SSL续费编辑站点,加上 # 这是原本的 location ~ /purge(/.*) { proxy_cache_purge cache_one $host$1$is_args$args; } #一键申请SSL证书验证目录相关设置,需要增加的 location ~ \.well-known{ root /www/wwwroot/你的站点目录; }
2024年01月22日
42 阅读
0 评论
0 点赞
2024-01-20
Lsky Pro图床
http换乘https的问题https://github.com/lsky-org/lsky-pro/issues/317docker-compose.yml文件内容version: '3' services: lsky-pro: container_name: lsky-pro image: dko0/lsky-pro restart: always volumes: - ./lsky-pro-data:/var/www/html #映射到本地 ports: - 8083:80 environment: - MYSQL_HOST=192.168.2.200 - MYSQL_DATABASE=lskypro - MYSQL_USER=lskypro - MYSQL_PASSWORD=lskypro # networks: # images_default: # ipv4_address: 172.18.0.2 # mysql: # image: mysql:8.0 # container_name: lsky-pro-db # restart: always # environment: # - MYSQL_DATABASE=lsky-pro # - MYSQL_USER=lsky-pro # - MYSQL_PASSWORD=lsky-pro # - MYSQL_ROOT_PASSWORD=lsky-pro # volumes: # - ./db:/var/lib/mysql # networks: # images_default: # ipv4_address: 172.18.0.3 networks: images_default: ipam: config: - subnet: 172.18.0.0/16 gateway: 172.18.0.1
2024年01月20日
63 阅读
0 评论
0 点赞
2024-01-11
接口测试之抓包实战解决 Android 高版本无法抓取 https
接口测试之抓包实战解决 Android 高版本无法抓取 https解决方案如下charles + VirtualXposed + JustTrustMe实现步骤进入 github 下载如下两个 pages VirtualXposed:https://github.com/android-hacker/VirtualXposed JustTrustMe:https://github.com/Fuzion24/JustTrustMe第一步使用如下 adb 命令分别安装两个 pagesadb -s <设备号> inatall VirtualXposed adb -s <设备号> install JustTrustMe设备号可以通过下面的命令查看adb devices -l第二部安装完成进入 VirtualXposed apk 应用,点击 6 个小点进入设置页面 第三步进入设置页面,点击模块管理,勾选 JustTrustMe(当然我并没有找到它,可能是我这个版本不需要在手动选择了,安装之后自动识别到了)重启之后我们重新进去设置页面,添加我们需要抓包的应用即可,我这里选择的企业微信做案例 第四步点击添加应用,选择需要抓包的软件安装 配置 charles 抓包设置 charles 代理,此处不再说明,相信设置代理大家能自己解决,手机设置 wifi 里面代理改成手动。输入 ip,端口:默认 8888,注意手机和电脑在一个 wifi 下就 ok,第六步回到 VirtualXposed 上滑解锁,打开我们之前安装的企业微信,则发现 charles 已经成功抓取到企业微信的 HTTPS 的数据包
2024年01月11日
65 阅读
0 评论
0 点赞
2024-01-11
JupyterNoteBook安装
1. 安装# 安装 pip install jupyter # 安装中文包 pip install jupyterlab-language-pack-zh-CN # 代码自动补全 pip install jupyterlab-lsp pip install -U jedi-language-server启动jupyter notebook配置虚拟环境# 首先需要进入到虚拟环境里面 .\python-venv\main\Scripts\activate # 这里演示的虚拟环境名称叫main python -m ipykernel install --user --name=main
2024年01月11日
37 阅读
0 评论
0 点赞
2024-01-05
Typecho全局开启https
在项目目录下,config.inc.php文件中,加入以下代码 /** 开启HTTPS */ define('__TYPECHO_SECURE__',true);
2024年01月05日
94 阅读
0 评论
0 点赞
2023-12-13
升级win11的一些方法
1.运行的方式安装官网下载win11镜像,挂载,进到挂载的文件里面双击运行setup.exe,发现不满足需求之后右键setup.exe,复制文件路径win + r打开运行,粘贴刚刚的路径,后面加上/product server,示例:"G:\setup.exe"/product server会以安装server的方式安装,安装步骤是一样的,建议保留文件、设置和应用2.修改文件下载完镜像之后解压,解压好之后打开解压的文件夹打开sources文件夹,里面找到appraiserres.dll文件,删掉新建一个文本文件,里面不用写任何东西,文件名修改成appraiserres.dll,后缀那些一样,然后右键,属性,把里面的属性改成只读返回上级进行安装也是一样的安装步骤
2023年12月13日
260 阅读
0 评论
0 点赞
2023-12-04
天翼云网关3.0/4.0超管密码
需要的软件:小翼管家4.0.3分享名称:小翼管家_4.0.3.apk分享链接:https://kedaoyun.geteshi.top/#s/96Bf8gjA访问密码:隐藏内容,请前往内页查看详情抓包软件,这里使用CharlesCharles抓包安装安装好小翼管家,绑定网关Charles的破解网址 https://www.zzzmode.com/mytools/charles/安装那些也一样破解手机把代理指向你的机器,SSL那些抓包自己找教程点开到网关设置界面,有指示灯那个之后会有几个api请求,https://nos9.189cube.com里面的,带有token的,点击随便一个,编辑把原始内容删掉,换成下面这个之后点击Execute隐藏内容,请前往内页查看详情之后可以获得一个pawdKaLi虚拟机抓包环境:网关型号 HN8145VBurp小翼管家版本4.0.3实现原理登录小翼管家APP,先将指示灯关闭。设置代理后,打开指示灯按钮,然后利用burp抓包。修改包数据即可! 破解过程我这里是准备好KALI虚拟机,kali虚拟机自带Burp 1.设置虚拟机为桥接! 2.开启虚拟机进入里面查看获取到得地址,然后ping网关确保能通信 3.打开Burp开启后的样子点击Proxy,然后点击Proxy settings弹出选项框:点击Add 添加我们对应的网卡地址跟端口配置完成后关闭选项框4.手机配置代理然后把手机连接光猫wifi 设置里面代理为KALI机器的IP地址跟对应的端口打开手机小翼管家绑定到自己的光猫上,然后进入网关设置把指示灯关闭5. KALI抓包获取超密回到Burp 在Proxy 把Intercept is on 开启接着右键选择下列选项然后在Repeater 查看刚刚数据包把2中的代码删除替换成下列代码隐藏内容,请前往内页查看详情
2023年12月04日
619 阅读
0 评论
0 点赞
2023-11-13
matrix搭建以及机器人配置
matrix的安装1. 创建配置文件sudo docker run -it --rm -v /tmp/data:/data -e SYNAPSE_SERVER_NAME=你的域名 -e SYNAPSE_REPORT_STATS=yes matrixdotorg/synapse:latest generate其中/tmp/data可以换,记得就行,这里用这个展示2. 到/tmp/data里面找到homeserver.yaml编辑 # Configuration file for Synapse. # # This is a YAML file: see [1] for a quick introduction. Note in particular # that *indentation is important*: all the elements of a list or dictionary # should have the same indentation. # # [1] https://docs.ansible.com/ansible/latest/reference_appendices/YAMLSyntax.html # # For more information on how to configure Synapse, including a complete accounting of # each option, go to docs/usage/configuration/config_documentation.md or # https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html server_name: "matrix域名" pid_file: /data/homeserver.pid listeners: - port: 8008 # 容器的端口号,不改 tls: false type: http x_forwarded: true resources: - names: [client, federation] compress: false # database: # name: sqlite3 # args: # database: /data/homeserver.db database: # 数据库设置,如果人少的话推荐上面的sqlite,pgdb太伤人了 name: psycopg2 args: user: matrix password: 24W53MDwk8TyBh7z database: matrix host: # 你懂的 cp_min: 5 cp_max: 10 # allow_unsafe_locale: true log_config: "/data/matrix域名.log.config" # 自动生成的,一般不用改 media_store_path: /data/media_store registration_shared_secret: "c:*RWamLStS9J,sQhm7=dwGpC2#DVKRtwCkCBvPwMJ&p" report_stats: true macaroon_secret_key: "g3@hjR7pMO2&enhNM*jKZq*l3=JS@d~Jl8J3ZvJ~smCkLD" form_secret: "I,kV-blS-oVG3h_c2kiQ&kH0P+=@V&pMedyu4~E-i;BzP" signing_key_path: "/data/matrix域名.signing.key" # 自动生成的,一般不用改 trusted_key_servers: - server_name: "matrix域名" # 开放注册 enable_registration: true # 注册不需要验证,没有配置邮箱的时候推荐这个不验证 enable_registration_without_verification: false # 注册需要验证邮箱 registrations_require_3pid: - email # 邮箱配置,这里用88邮箱演示 email: smtp_host: "smtp.88.com" smtp_port: 465 smtp_user: "发送的邮箱地址" smtp_pass: "密码,你懂的" force_tls: true require_transport_security: true enable_tls: true notif_from: "通知的邮箱地址" app_name: "聊天室" enable_notifs: true notif_for_new_users: true client_base_url: "https://element的域名" validation_token_lifetime: 15m invite_client_location: https://element的域名3. docker-compose 文件version: "3.3" services: synapse: image: "matrixdotorg/synapse:latest" container_name: "matrix_synapse" restart: unless-stopped ports: - 8008:8008 volumes: - "./data:/data" # 这个data需要上面的/tmp/data,我的这个文件放在/tmp里面,所以用了./data environment: VIRTUAL_HOST: "matrix域名" VIRTUAL_PORT: 8008 LETSENCRYPT_HOST: "matrix域名" SYNAPSE_SERVER_NAME: "matrix域名" SYNAPSE_REPORT_STATS: "yes" element-web: ports: - '80:80' volumes: - './data/config.json:/app/config.json' image: vectorim/element-web restart: unless-stopped搭建到这里就完了{lamp/}使用nio-bot安装这两个库pip nio-bot pip install nio-bot[e2ee,cli]实例文件import logging # from niobot import NioBot, Context import niobot from apscheduler.schedulers.asyncio import AsyncIOScheduler logging.basicConfig(level=logging.INFO) bot = niobot.NioBot( homeserver="https://test.test.test", # your homeserver user_id="@test:test.test.test", # the user ID to log in as (Fully qualified) device_id="nio-message", store_path=r"./store/", command_prefix="!", # the prefix to respond to (case sensitive, must be lowercase if below is True) case_insensitive=True, # messages will be lower()cased before being handled. This is recommended. owner_id="@user:test.test.test", # The user ID who owns this bot. Optional, but required for bot.is_owner(...). ignore_self=True ) # bot.mount_module("test.py") def schedule_auto_messages(): scheduler = AsyncIOScheduler() # 测试的定时任务 # scheduler.add_job(test, "cron", second="*/3", id="test", misfire_grace_time=180, args=[bot]) scheduler.start() @bot.on_event("ready") async def on_ready(sync_result: niobot.SyncResponse): print("Logged in!") schedule_auto_messages() @bot.command("ping") async def ping_command(ctx: niobot.Context): latency = ctx.latency # await ctx.reply("Pong!") await ctx.respond(f"Pong! `{latency:.2f}ms` latency.") # A command with arguments @bot.command(name="echo") async def echo_command(ctx: niobot.Context, message: str): print("这里的输出") await ctx.respond(message) # bot.run(password="password") # starts the bot with a password. If you already have a login token, see: bot.run(access_token="token") # starts the bot with a login token.获取token使用这个命令niocli get-access-token -U '@test:test.test.test' -D '设备id->device_id'验证设备https://github.com/poljar/matrix-nio/blob/main/examples/verify_with_emoji.py通过表情符号验证,申请token使用上面那个,获取token的方式,之后用这个验证,需要创建一个文件// credentials.json {"homeserver": "https://matrix.example.org", "user_id": "@test:matrix.example.org", "device_id": "niobot2", "access_token": "上面那个"}之后直接运行,多尝试几次,不成功就把store里面的文件删掉。重新获取token,先运行机器人的文件,再运行这个表情包验证文件!!
2023年11月13日
295 阅读
0 评论
0 点赞
2023-11-04
宝塔面板的PostgreSQL
前言宝塔面板对于PostgreSQL的支持很低,很多比如设置单个数据库的字符编码之类的,问题很多# 首先进入postgres用户 su - postgres # 进入pg psql -U postgres # 创建数据库 ./createdb -E UTF8 -l C -T template0 -O matrix matrix;这时候会发现没办法使用createdb创建数据库,所以需要这样弄,切换到/www/server/pgsql/bin目录里面,这样就能创建成功这时候可以在宝塔面板左侧的数据库PgSQL里面同步一下,就能把数据库同步过来,但是这时候还是无法连接的需要使用PostgreSQL 管理器-->数据库-->创建一个一模一样的数据库,然后把权限改成所有人,之后才可以访问真折磨
2023年11月04日
320 阅读
0 评论
0 点赞
2023-10-31
pyenv使用教程
[root@localhost ~]# cat /etc/redhat-release CentOS release 6.9 (Final) 系统默认是Python 2.6 版本 [root@localhost ~]# python -V Python 2.6.6 1) 安装依赖环境 [root@localhost ~]# yum -y install gcc zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel git 2) 安装pyenv包 pyenv可以通过多种方式安装,可以参考项目在github上的Installtion, 地址为: https://github.com/pyenv/pyenv-installer 推荐采用The automatic installer的方式安装,可以一键安装pyenv的所有插件。 [root@localhost ~]# curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash pyenv套件下插件: - pyenv-doctor - pyenv-installer - pyenv-update - pyenv-virtualenv - pyenv-which-ext ================================================================================== 温馨提示: 以上https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer的访问内容 , 可以将内容粘出来放在服务器的一个shell脚本文件中, 然后执行该脚本用以安装pyenv 该脚本下载地址: https://pan.baidu.com/s/1wW9ylrmc4Q9wxu_i3-1wYA 提取密码: rhtj 执行脚本进行安装(执行前授予755权限) # chmod 755 pyenv-installer # /bin/bash pyenv-installer ================================================================================= 分析一下上面的pyenv-installer脚本,可以发现在centos上,其实它做了以下事情: git clone --depth 1"git://github.com/pyenv/pyenv.git" "${HOME}/.pyenv" git clone --depth 1"git://github.com/pyenv/pyenv-doctor.git" "${HOME}/.pyenv/plugins/pyenv-doctor" git clone --depth 1"git://github.com/pyenv/pyenv-installer.git" "${HOME}/.pyenv/plugins/pyenv-installer" git clone --depth 1"git://github.com/pyenv/pyenv-update.git" "${HOME}/.pyenv/plugins/pyenv-update" git clone --depth 1"git://github.com/pyenv/pyenv-virtualenv.git" "${HOME}/.pyenv/plugins/pyenv-virtualenv" git clone --depth 1"git://github.com/pyenv/pyenv-which-ext.git" "${HOME}/.pyenv/plugins/pyenv-which-ext" 上面安装完成后,还需要执行下面的命令,将pyenv安装到系统环境变量中。 [root@localhost ~]# ll -d /root/.pyenv drwxr-xr-x 11 root root 4096 Dec 17 10:48 /root/.pyenv 在~/.bash_profile文件底部添加下面三行内容, 让系统可以找到 pyenv 安装的 Python [root@localhost ~]# vim ~/.bash_profile export PATH="/root/.pyenv/bin:$PATH" eval "$(pyenv init -)" eval "$(pyenv virtualenv-init -)" # Ubuntu使用这个 echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc echo 'command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc echo 'eval "$(pyenv init -)"' >> ~/.bashrc 使上面配置生效 [root@localhost ~]# source ~/.bash_profile 查看pyenv安装情况 [root@localhost ~]# pyenv --version //或者"pyenv -v" pyenv 1.2.8 更新pyenv [root@localhost ~]# pyenv update 3) 卸载pyenv 先删除pyenv的安装目录, 这里即是/root/.pyenv [root@localhost ~]# rm -fr /root/.pyenv 接着删除~/.bash_profile里面配置的系统环境变量 [root@localhost ~]# vim ~/.bash_profile //删除下面三行 export PATH="/root/.pyenv/bin:$PATH" eval "$(pyenv init -)" eval "$(pyenv virtualenv-init -)" [root@localhost ~]# source ~/.bash_profile 这样pyenv就被卸载了, 卸载pyenv后, 当前终端shell里会出现"-bash: pyenv: command not found" 的提示信息, 不过不影响使用. 再打开其他的终端窗口, 就不会出现该提示信息. 安装太慢的话,下载对应的包,放到这个里面{message type="info" content="如果没有cache,自己创建一个"/}.pyenv\cachepyenv常用命令pyenv install --list # 列出可安装版本 pyenv install <version> # 安装对应版本 pyenv install -v <version> # 安装对应版本,若发生错误,可以显示详细的错误信息 pyenv versions # 显示当前使用的python版本 pyenv which python # 显示当前python安装路径 pyenv global <version> # 设置默认Python版本 pyenv local <version> # 当前路径创建一个.python-version, 以后进入这个目录自动切换为该版本 pyenv shell <version> # 当前shell的session中启用某版本,优先级高于global 及 local
2023年10月31日
194 阅读
0 评论
0 点赞
1
...
3
4
5
...
7