多版本python使用pip
“灵感,是天才的女神。她并不步履蹒跚地走过,而是在空中像乌鸦那么警觉地飞过的,她没有什么剽带给诗人抓握,她的头是一团烈火,她溜得快,像那些白里带红的鹤,教猎人见了无可奈何。”——巴尔扎克 我们有时安装了多个版本的python 我本机安装了python2和python3 配置的环境变量中pip install只会安装python2的依赖 如果我要安装3的,可以使用: 1python3 -m pip install [依赖]
python读取oss的psd并上传jpg
死亡,就像是水消失在水中。——博尔赫斯《另一次死亡》 上次说过了psd-tools可以对psd进行处理 今天写一个完整的,oss代码在这: https://VampireAchao.github.io/2022/04/26/python%E5%AF%B9%E6%8E%A5oss%E4%B8%8A%E4%BC%A0%E5%92%8C%E4%B8%8B%E8%BD%BD/ 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253# coding=utf-8import warningsfrom io import BytesIOfrom psd_tools.constants import Resourcewarnings.filterwarnings("ignore", category=Warning)# 读取psd以及图层信息def read_psd_info(psd, hidden_layer_ids): la...
python部分依赖踩坑
今天所做之事勿候明天,自己所做之事勿候他人。——歌德 今天运行脚本时警告: 123DependencyWarning: SOCKS support in urllib3 requires the installation of optional dependencies: specifically, PySocks.For more information, see https://urllib3.readthedocs.io/en/latest/contrib.html#socks-proxies 我的python版本为2.7.17 于是安装对应的模块 1pip install win-inet-pton 发现还有一个警告: 1CryptographyDeprecationWarningPython 2 is no longer supported by the Python core team 于是我先卸载 1pip uninstall cryptography 然后安装适配的版本 1pip install cryptography==2.6 再次运行即可
python对接oss上传和下载
我用尽全力,过着平凡的一生。——毛姆 首先是下载依赖,文档: https://help.aliyun.com/document_detail/85288.html 我这里是windows: 1pip install oss2 代码也是一如既往的简单,毕竟是python嘛 123456789101112131415161718from io import BytesIOimport oss2ACCESS_KEY_ID = ''ACCESS_KEY_SECRET = ''ENDPOINT = 'oss-cn-chengdu.aliyuncs.com'BUCKET_NAME = 'waibi'AUTH = oss2.Auth(ACCESS_KEY_ID, ACCESS_KEY_SECRET)BUCKET = oss2.Bucket(AUTH, ENDPOINT, BUCKET_NAME)def download_file_bytes(file_name): return BUCKET.get_o...
网站档案馆
一个人追求的目标越高,他的才能就发展得越快,对社会就越有益,我确信这也是一个真理。——玛克西姆·高尔基 分享一个网站可以访问网站历年来的档案存档 https://web.archive.org/ 例如2014年的bilibili 非常有意思
thymeleaf和vue快速入门
时间是个常数,但也是个变数。勤奋的人无穷多,懒惰的人无穷少。——字严 今天中午午休抽时间写了个thymeleaf和vue使用elementUI简单入门Demo 仓库地址:https://gitee.com/VampireAchao/simple-thymeleaf-html.git 前端代码如下: 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354<!doctype html><html><head> <title>给胖哥的html页面</title> <!-- 引入样式,从这来的 https://element.eleme.cn/#/zh-CN/component/installation#cdn --> <link href="https://unpkg.com/element-ui/lib/theme-chalk/ind...
drag事件
生活最沉重的负担不是工作,而是无聊。——罗曼·罗兰 首先是MDN:https://developer.mozilla.org/zh-CN/docs/Web/API/HTML_Drag_and_Drop_API 然后是代码: 123456789101112131415161718192021222324252627282930313233343536373839404142<!DOCTYPE html><html> <head> <style> .drop-container{ width: 200px; height: 200px; border: 1px solid red; background: #eee; } .drag-ball{ w...
css实现鼠标划入显示拖动条
古之立大事者,不惟有超世之才,亦必有坚忍不拔之志。——苏轼 代码如下: 1234567891011121314151617181920212223242526272829<!DOCTYPE html><html> <head> <style> .ruben-container{ height: calc(100vh - 70vh); width: calc(100vw - 70vw); overflow-y: auto; } .ruben-container::-webkit-scrollbar { width: 4px; } .ruben-container::-webkit-scrollbar-thumb{ ...
在SpringBoot单元测试中添加参数
我的肩上是风,风上是闪烁的星群。——北岛《结局或开始·献给遇罗克》 当时是解决一个issue而去查阅的 https://github.com/baomidou/mybatis-plus/issues/4417 最后代码如下: 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566package com.ruben.mybatisplusissue;import javax.annotation.Resource;import org.junit.jupiter.api.Test;import org.junit.jupiter.api.extension.ExtendWith;import org.springframework.boot.SpringApplication;import org.springframework.boot.test.context.SpringBootCo...
jenkins部署jar并启动脚本
等到看你银色满际,等到分不清季节更替,才敢说沉溺。——《水星记》 首先是shell命令 123456789101112# 打包mvn -DskipTests=true -Ptest clean package# 结束进程ps -ef | grep translate_server | awk '{print $2}' | xargs kill -9 || true# 移动mv './target/ruben.jar' '/server/ruben.jar'# 删除日志rm -f '/test/ruben_log.txt' || true# 创建日志touch '/test/ruben_log.txt'# 静默启动nohup sh /server/ruben.sh 这里启动的ruben.sh如下: 12345678#!/bin/bashBUILD_ID=DONTKILLMEfunction start(){nohup java -jar ...
