破事一堆
用conda装pytorch装不上
TLNR:最后用pip装的。
用conda装pytorch
1
conda install pytorch torchvision torchaudio pytorch-cuda=12.1 -c pytorch -c nvidia
报错,估计是连不上pytorch和nvidia的网
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
Collecting package metadata (repodata.json): / Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f88049b5dd0>: Failed to establish a new connection: [Errno 101] Network is unreachable')': /nvidia/noarch/repodata.json.zst
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f88049a2690>: Failed to establish a new connection: [Errno 101] Network is unreachable')': /pytorch/noarch/repodata.json.zst
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f87ffe00910>: Failed to establish a new connection: [Errno 101] Network is unreachable')': /pytorch/linux-64/repodata.json.zst
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f880806b0d0>: Failed to establish a new connection: [Errno 101] Network is unreachable')': /nvidia/linux-64/repodata.json.zst
| Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f88048f3ed0>: Failed to establish a new connection: [Errno 101] Network is unreachable')': /pytorch/linux-64/repodata.json.zst
Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f8808002e50>: Failed to establish a new connection: [Errno 101] Network is unreachable')': /pytorch/noarch/repodata.json.zst
Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f88080037d0>: Failed to establish a new connection: [Errno 101] Network is unreachable')': /nvidia/noarch/repodata.json.zst
Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f87ffd23ad0>: Failed to establish a new connection: [Errno 101] Network is unreachable')': /nvidia/linux-64/repodata.json.zst
\ Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f88049a1890>: Failed to establish a new connection: [Errno 101] Network is unreachable')': /pytorch/linux-64/repodata.json.zst
Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f88049a14d0>: Failed to establish a new connection: [Errno 101] Network is unreachable')': /pytorch/noarch/repodata.json.zst
Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f88049a3950>: Failed to establish a new connection: [Errno 101] Network is unreachable')': /nvidia/linux-64/repodata.json.zst
Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f88049a2ad0>: Failed to establish a new connection: [Errno 101] Network is unreachable')': /nvidia/noarch/repodata.json.zst
failed
CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://conda.anaconda.org/pytorch/linux-64/repodata.json>
Elapsed: -
An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on your way.
'https//conda.anaconda.org/pytorch/linux-64'
默认的源
1
conda install pytorch torchvision torchaudio pytorch-cuda=12.1
找不到pytorch-cuda和torchaudio
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
Channels:
- defaults
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
Platform: linux-64
Collecting package metadata (repodata.json): done
Solving environment: failed
PackagesNotFoundError: The following packages are not available from current channels:
- pytorch-cuda=12.1*
- torchaudio
Current channels:
- defaults
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/linux-64
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/noarch
To search for alternate channels that may provide the conda package you're
looking for, navigate to
https://anaconda.org
and use the search bar at the top of the page.
到清华镜像站本地下载对应版本,然后本地安装:
1
conda install pytorch-2.3.1-py3.12_cuda12.1_cudnn8_0.tar.bz2
conda list
显示装上了,试试是否可用。
1
2
import torch
torch.cuda
至少没装完整
1
2
3
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'torch' has no attribute 'cuda'
卸了,加了更多镜像,但还是不行,libcublas安装不上。
1
2
3
4
5
6
7
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/menpo/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
conda config --set show_channel_urls yes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
Channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/menpo
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
- defaults
Platform: linux-64
Collecting package metadata (repodata.json): done
Solving environment: failed
LibMambaUnsatisfiableError: Encountered problems while solving:
- nothing provides libcublas >=12.1.0.26,<12.1.3.1 needed by pytorch-cuda-12.1-ha16c6d3_5
Could not solve for environment specs
The following package could not be installed
└─ pytorch-cuda 12.1** is not installable because it requires
└─ libcublas >=12.1.0.26,<12.1.3.1 , which does not exist (perhaps a missing channel).
应该是恰好没这个版本的libcublas,其他源也下不到,直接去nvidia那里下了一个,本地安装
1
2
3
4
Could not solve for environment specs
The following package could not be installed
└─ pytorch-cuda 12.1** is not installable because it requires
└─ libcufft >=11.0.2.4,<11.0.2.54 , which does not exist (perhaps a missing channel).
好家伙,这一个个的不会都让我本地安装吧。
装了几个之后,发现了安装冲突:
1
2
3
4
5
6
Could not solve for environment specs
The following package could not be installed
└─ pytorch-cuda 12.1** is not installable because it requires
├─ cuda-libraries >=12.1,<12.2 , which requires
│ └─ libcublas 12.1.3.1.* , which can be installed;
└─ libcublas >=12.1.0.26,<12.1.3.1 , which conflicts with any installable versions previously reported.
最后拿pip装了
1
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
1
2
3
4
5
6
7
8
9
>>> import torch
tor>>> torch.cuda
<module 'torch.cuda' from '/home/ubuntu/anaconda3/envs/llm/lib/python3.12/site-packages/torch/cuda/__init__.py'>
>>> torch.cuda.is_avaliable
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'torch.cuda' has no attribute 'is_avaliable'. Did you mean: 'is_available'?
>>> torch.cuda.is_available()
True
在远程端没python环境
在远程端安装python插件等。
似乎是网的问题,有点装不上,本地安装,下载vsix文件,比如python,点击Download Extension
,下载好后放到远程端,插件页面右上角三个点,从vsix安装。
1
Unable to install extension 'ms-python.python' as it is not compatible with VS Code '1.83.0'.
应该是我vscode版本需要更新了,更新了一下vscode,便携版只要保留data
文件夹就好了。
结果网好像又好了,能直接在插件商店安装了,所以说不定之前不能安装是因为我vscode版本太旧了。
jupyter跑不了,需要ipykernal,结果又安装不上去了,但是这次报错给了信息
1
2
3
运行具有“llm (Python 3.12.4)”的单元格需要ipykernel包。
运行以下命令,将 "ipykernel" 安装到 Python 环境中。
命令: "conda install -n llm ipykernel --update-deps --force-reinstall"
llm是我环境的名字。
安装gym时找不到rendering文件
从这里下载后安装到gym/envs/classic_control
。
话说为什么会少个文件啊。
安装gym[box2d]失败
报错
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Requirement already satisfied: gym[box2d] in g:\software\anaconda3\envs\torch\lib\site-packages (0.26.2)
Requirement already satisfied: numpy>=1.18.0 in g:\software\anaconda3\envs\torch\lib\site-packages (from gym[box2d]) (1.26.4)
Requirement already satisfied: cloudpickle>=1.2.0 in g:\software\anaconda3\envs\torch\lib\site-packages (from gym[box2d]) (3.0.0)
Requirement already satisfied: gym-notices>=0.0.4 in g:\software\anaconda3\envs\torch\lib\site-packages (from gym[box2d]) (0.0.8)
Collecting box2d-py==2.3.5 (from gym[box2d])
Using cached https://pypi.tuna.tsinghua.edu.cn/packages/dd/5a/ad8d3ef9c13d5afcc1e44a77f11792ee717f6727b3320bddbc607e935e2a/box2d-py-2.3.5.tar.gz (374 kB)
Preparing metadata (setup.py) ... done
Collecting pygame==2.1.0 (from gym[box2d])
Using cached https://pypi.tuna.tsinghua.edu.cn/packages/e0/ce/1215d864989d25cb7b234759ce6a760813dffe2e707df7f8e3e748538ba0/pygame-2.1.0-cp310-cp310-win_amd64.whl (4.8 MB)
Collecting swig==4.* (from gym[box2d])
Using cached https://pypi.tuna.tsinghua.edu.cn/packages/d0/ef/44fb7b4216530551460666286ec04424d34f4a25e8fba1cebe742a24e012/swig-4.2.1-py2.py3-none-win_amd64.whl (2.6 MB)
Building wheels for collected packages: box2d-py
Building wheel for box2d-py (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [16 lines of output]
Using setuptools (version 67.8.0).
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-cpython-310
creating build\lib.win-amd64-cpython-310\Box2D
copying library\Box2D\Box2D.py -> build\lib.win-amd64-cpython-310\Box2D
copying library\Box2D\__init__.py -> build\lib.win-amd64-cpython-310\Box2D
creating build\lib.win-amd64-cpython-310\Box2D\b2
copying library\Box2D\b2\__init__.py -> build\lib.win-amd64-cpython-310\Box2D\b2
running build_ext
building 'Box2D._Box2D' extension
swigging Box2D\Box2D.i to Box2D\Box2D_wrap.cpp
swig.exe -python -c++ -IBox2D -small -O -includeall -ignoremissing -w201 -globals b2Globals -outdir library\Box2D -keyword -w511 -D_SWIG_KWARGS -o Box2D\Box2D_wrap.cpp Box2D\Box2D.i
error: command 'swig.exe' failed: None
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for box2d-py
Running setup.py clean for box2d-py
Failed to build box2d-py
ERROR: Could not build wheels for box2d-py, which is required to install pyproject.toml-based projects
用conda装据说可以,但是我装不上
1
pip install ufal.pybox2d
这个可以
将python程序变成exe
pip安装pyinstaller
1
pyinstaller -y -F -w -n demodemo.py
-F是单文件、-w是无控制台(如果要用到input()
等函数要去掉)
排除特定标签的xpath方法
例如element..xpath('.//text()[not(ancestor::rt)]')
旧版本的可空参数
3.8版本不支持竖线可空,要用typing
模块
1
2
3
4
5
from typing import Union
import numpy as np
def func(a: Union[np.ndarray, None] = None):
pass
1
2
3
4
5
from typing import Optional
import numpy as np
def func(a: Optional[np.ndarray] = None):
pass
调用了一个方法结果返回值被元组包裹
检查一下是不是不小心多了加了个逗号
1
result = tensor.reshape((2, 3)), # 逗号意外创建了一个元组
如何开发一个VS Code插件 写一个自动加ruby的功能
插件
开发环境
1
2
npm install -g yo generator-code
yo code
yo也就是Yeoman,Yeoman是一个脚手架工具,帮助开发人员使用预定义的模板和生成器创建项目。它通过自动化重复任务来简化设置新项目的过程。generator-code是VS Code 扩展设计的Yeoman生成器。它提供一组脚手架模板和工具,可快速创建适用于VSCode编辑器的新扩展,需要与yo配合使用。
选择TypeScript 配置插件。
生成目录,点进去。
说一下几个文件
├─ src │ ├─ extension.ts // 代码本体 ├─ package.json // 插件配置 ├─ README.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
{
"name": "ruby-converter", // 插件名
"displayName": "ruby-converter",
"description": "Convert a word to Ruby.",
"version": "0.0.1",
"engines": {
"vscode": "^1.96.0" // 版本 直接建议更到最新 ^表示最旧版本 如果版本比这个旧会报错
},
"categories": [
"Other"
],
"activationEvents": [],
"main": "./out/extension.js", // 编译输出的目录
"contributes": {
"commands": [
{
"command": "ruby-converter.convertToRuby",
"title": "ruby-converter.convertToRuby"
}
],
"menus": {
"editor/context": [
{
"command": "ruby-converter.convertToRuby",
"when": "editorHasSelection",
"group": "1_modification"
}
]
},
"keybindings": [
{
"command": "ruby-converter.convertToRuby",
"key": "ctrl+alt+a",
"when": "editorHasSelection"
}
]
},
"scripts": {
"vscode:prepublish": "npm run compile",
"compile": "tsc -p ./",
"watch": "tsc -watch -p ./",
"pretest": "npm run compile && npm run lint",
"lint": "eslint src",
"test": "vscode-test"
},
"devDependencies": {
"@types/kuromoji": "^0.1.3",
"@types/mocha": "^10.0.10",
"@types/node": "20.x",
"@types/vscode": "^1.96.0",
"@typescript-eslint/eslint-plugin": "^8.17.0",
"@typescript-eslint/parser": "^8.17.0",
"@vscode/test-cli": "^0.0.10",
"@vscode/test-electron": "^2.4.1",
"eslint": "^9.16.0",
"typescript": "^5.7.2"
},
"dependencies": {
"kuromoji": "^0.1.2"
}
}
编译可以用指令启用监听模式
1
npm run watch
插件本体
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// 执行命令时被激活
export function activate(context: vscode.ExtensionContext) {
// 使用控制台输出诊断信息(console.log)和错误(console.error)
// 这行代码只会在你的扩展被激活时执行一次
console.log('Congratulations, your extension "svg-viewer" is now active!');
// 注册命令,commandId 参数必须与 package.json 中的 command 字段匹配
let disposable = vscode.commands.registerCommand(
"svg-viewer.previewsvg",
() => {
// 具体要做的内容
}
);
context.subscriptions.push(disposable);
}
打包 先安装vsce
1
npm i vsce -g
1
vsce package
可能会报错版本不够、缺少文件、需要写README等问题 一一照做 打包出vsix就可以本地安装了。
发布以后再说
插件功能
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import * as vscode from 'vscode';
import * as path from "path";
import kuromoji from "kuromoji";
export function activate(context: vscode.ExtensionContext) {
console.log('Congratulations, your extension "ruby-converter" is now active!');
let disposable = vscode.commands.registerCommand('ruby-converter.convertToRuby', () => {
const editor = vscode.window.activeTextEditor;
if (editor) {
// 获取当前文档和选中文本
const document = editor.document;
const selection = editor.selection;
const selectedText = document.getText(selection);
// 当前的kuromoji路径 这里是为了适配开发环境和生产环境
const devDicPath = path.join(__dirname, "../node_modules/kuromoji/dict/");
const prodDicPath = path.join(__dirname, "node_modules/kuromoji/dict/");
const fs = require("fs");
const dicPath = fs.existsSync(devDicPath) ? devDicPath : prodDicPath;
// 使用 kuromoji 分词并生成假名
kuromoji.builder({ dicPath }).build((err, tokenizer) => {
if (err) {
vscode.window.showErrorMessage(`Kuromoji initialization failed. ${err}`);
return;
}
const tokens = tokenizer.tokenize(selectedText);
let rubyText = '';
const kanjiRegex = /[\u4E00-\u9FFF]/; // 匹配汉字的正则表达式
// 遍历每个词汇并生成 <ruby> 标签
tokens.forEach(token => {
const surface = token.surface_form; // 原始文本
const reading = token.reading
if (kanjiRegex.test(surface) && reading) {
const hiragana = reading.replace(/[\u30a1-\u30f6]/g, (match) => String.fromCharCode(match.charCodeAt(0) - 0x60));
rubyText += `<ruby>${surface}<rt>${hiragana}</rt></ruby>`;
}
else {
rubyText += surface;
}
});
// 替换文本
editor.edit(editBuilder => {
editBuilder.replace(selection, rubyText);
});
});
}
});
context.subscriptions.push(disposable);
}
export function deactivate() { }
每页ppt保存为图片 修改分辨率
修改注册表HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\PowerPoint\Options
新建项ExportBitmapResolution
,默认值为96 1280*720
Neo4j Desktop打不开了
查看日志C:\Users\username\.Neo4jDesktop\log.log
报错
1
2
3
4
5
6
7
8
9
10
[2025-01-13 03:31:34.636] [info] Configuring proxy: NO_PROXY
[2025-01-13 03:31:35.051] [warn] ERROR: {"error":"Fetch status [403]","url":"https://dist.neo4j.org/neo4j-desktop/win/latest.yml"}
[2025-01-13 03:31:35.052] [error] App initialization error TypeError: Cannot read properties of undefined (reading 'name')
at isReachable (G:\Software\Neo4j Desktop\resources\app.asar\dist\main.prod.js:6237:25)
at process.processTicksAndRejections (node:internal/process/task_queues:96:5)
at async isOnline (G:\Software\Neo4j Desktop\resources\app.asar\dist\main.prod.js:6247:9)
at async broadcastOnline (G:\Software\Neo4j Desktop\resources\app.asar\dist\main.prod.js:11850:20)
at async configureProxy (G:\Software\Neo4j Desktop\resources\app.asar\dist\main.prod.js:11925:5)
at async initProxy (G:\Software\Neo4j Desktop\resources\app.asar\dist\main.prod.js:11936:5)
at async App.<anonymous> (G:\Software\Neo4j Desktop\resources\app.asar\dist\main.prod.js:13088:9)
这个网页打不开了。
断网就能打开了。(记得杀掉之前启动的进程)
据说更好的方式是改代理配置文件,不过我这边已经打开了就先完再说了。
markdown-toc无法生成含有百分号的标题
突然就无法生成了,非常奇怪。之前一直没有这个问题的。今天也有一次成功生成了,但是之后没有再复现。 于是二分查找,最后是发现标题里有一个百分号。
之后去查了issue,结果早在几年前就有人提这个问题了,未解决。
那我成功的几回是怎么生成出来的?
发现了只要出现Table of Contents (up to date)字样的话,就不会被百分号的bug影响。这个字样只要一开始在就一直在,删掉目录不太多行也会一直在。
没搞懂,但是也只能姑且这样了。
如何用bat启动anaconda
1
call G:\Software\anaconda3\Scripts\activate.bat <env_name>
write_videofile报错
1
video.write_videofile(path, fps=24)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Traceback (most recent call last):
File "g:\Program\PytonTool\kanji\auto_audio.py", line 34, in <module>
video.write_videofile("./kanji/videos/output_video.mp4", fps=24)
File "G:\Software\Python\Python311\Lib\site-packages\decorator.py", line 232, in fun
return caller(func, *(extras + args), **kw)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "G:\Software\Python\Python311\Lib\site-packages\moviepy\decorators.py", line 54, in requires_duration
return f(clip, *a, **k)
^^^^^^^^^^^^^^^^
File "G:\Software\Python\Python311\Lib\site-packages\decorator.py", line 232, in fun
return caller(func, *(extras + args), **kw)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "G:\Software\Python\Python311\Lib\site-packages\moviepy\decorators.py", line 135, in use_clip_fps_by_default
return f(clip, *new_a, **new_kw)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "G:\Software\Python\Python311\Lib\site-packages\decorator.py", line 232, in fun
return caller(func, *(extras + args), **kw)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "G:\Software\Python\Python311\Lib\site-packages\moviepy\decorators.py", line 22, in convert_masks_to_RGB
return f(clip, *a, **k)
^^^^^^^^^^^^^^^^
File "G:\Software\Python\Python311\Lib\site-packages\moviepy\video\VideoClip.py", line 300, in write_videofile
ffmpeg_write_video(self, filename, fps, codec,
File "G:\Software\Python\Python311\Lib\site-packages\moviepy\video\io\ffmpeg_writer.py", line 213, in ffmpeg_write_video
with FFMPEG_VideoWriter(filename, clip.size, fps, codec = codec,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "G:\Software\Python\Python311\Lib\site-packages\moviepy\video\io\ffmpeg_writer.py", line 88, in __init__
'-r', '%.02f' % fps,
~~~~~~~~^~~~~
TypeError: must be real number, not NoneType
该去看源码的,但是换了个旧版本的环境就好了
遇到まぎ时报错
如果是まぎ或者まぎ-之类的就会报错,完全不明所以。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
File "G:\Software\anaconda3\envs\manim\lib\site-packages\manimlib\mobject\svg\text_mobject.py", line 149, in __init__
super().__init__(text, **kwargs)
File "G:\Software\anaconda3\envs\manim\lib\site-packages\manimlib\mobject\svg\labelled_string.py", line 64, in __init__
super().__init__()
File "G:\Software\anaconda3\envs\manim\lib\site-packages\manimlib\mobject\svg\svg_mobject.py", line 65, in __init__
self.init_svg_mobject()
File "G:\Software\anaconda3\envs\manim\lib\site-packages\manimlib\mobject\svg\svg_mobject.py", line 76, in init_svg_mobject
self.generate_mobject()
File "G:\Software\anaconda3\envs\manim\lib\site-packages\manimlib\mobject\svg\labelled_string.py", line 79, in generate_mobject
super().generate_mobject()
File "G:\Software\anaconda3\envs\manim\lib\site-packages\manimlib\mobject\svg\svg_mobject.py", line 102, in generate_mobject
mobjects = self.get_mobjects_from(svg)
File "G:\Software\anaconda3\envs\manim\lib\site-packages\manimlib\mobject\svg\svg_mobject.py", line 156, in get_mobjects_from
mob = self.path_to_mobject(shape)
File "G:\Software\anaconda3\envs\manim\lib\site-packages\manimlib\mobject\svg\svg_mobject.py", line 221, in path_to_mobject
return VMobjectFromSVGPath(path, **self.path_string_config)
File "G:\Software\anaconda3\envs\manim\lib\site-packages\manimlib\mobject\svg\svg_mobject.py", line 301, in __init__
super().__init__(**kwargs)
File "G:\Software\anaconda3\envs\manim\lib\site-packages\manimlib\mobject\types\vectorized_mobject.py", line 85, in __init__
super().__init__(**kwargs)
File "G:\Software\anaconda3\envs\manim\lib\site-packages\manimlib\mobject\mobject.py", line 89, in __init__
self.init_points()
File "G:\Software\anaconda3\envs\manim\lib\site-packages\manimlib\mobject\svg\svg_mobject.py", line 315, in init_points
self.triangulation = np.load(tris_filepath)
File "G:\Software\anaconda3\envs\manim\lib\site-packages\numpy\lib\npyio.py", line 432, in load
return format.read_array(fid, allow_pickle=allow_pickle,
File "G:\Software\anaconda3\envs\manim\lib\site-packages\numpy\lib\format.py", line 832, in read_array
array.shape = shape
ValueError: cannot reshape array of size 1024 into shape (1056,)
我把numpy\lib\format.py 832行包了个try-catch
1
2
3
4
try:
array.shape = shape
except ValueError:
pass
暂时能用了,希望不要搞坏什么。
Selenium输出html不完整
可能是某些转义有问题。
1
self.driver.get("data:text/html;charset=utf-8," + urllib.parse.quote(html_content))
这样写就好了。
VSCode莫名卡顿
最近vscode莫名卡顿(并非最近),总结了以下现象:
- 粘贴、回车、backspace卡顿,但是打字、delete、复制、剪切等操作正常,界面也可以正常拖拽使用
- 有一个小圆圈正在转,左下角有时候会转显示“正在激活扩展…” 少数情况,会报错“command ‘markdown.extension.onEnterKey’ not found”
- 一般而言,一个文件卡另一个文件不一定卡,但是也有全都卡的情形
- 全都卡的情形,打开新vscode窗口也会卡,但是在现有的窗口开新文件不会卡,变得不卡后,会把之前按下的enter和backspace全都应用,有时按上下左右改了光标位置,enter和backspace也是在新位置应用开启新窗口。下了个打字特效,打字特效也会消失,并且有可能会刷出多个打字特效在不同地方一起一直闪的效果。
- 在侧边栏预览也会出问题
- 创建文件也会卡,显示“正在运行‘文件创建参与者’”
- Github Desktop也卡顿
- 运行新程序会卡,即使是sublime也会卡,记事本打开得要比sublime快。
暂且怀疑是插件的问题,或者是浏览器,或者是CPU的问题。 为了知道是哪个插件有问题,我觉得最好需要记录耗时。
- 禁用了Markdown All in One,回车和backspace没事了,其他似乎流畅了一些,但照旧?
- Markdown语言功能,Unresponsive
chirpy Build没过
虽然表面上看着是
1
2
3
* At _site/posts/HTML/index.html:1:
internally linking to #框架; the file exists, but the hash '框架' does not
但是我觉得是最上面的问题报错后,影响了后面的检查,先改上面的。
话说为什么图片必须要alt属性。
改完了,问题依旧,二分排查。
为什么链接必须要https。
最后我选择删除了目录
给Chirpy的post加作者
我想加作者,但是在文档里没有找到。
1
2
3
4
5
6
7
8
9
10
11
---
title: "你的博客标题" # 博客标题
date: 2023-10-05 # 发布日期
categories: [分类1, 分类2] # 博客分类
tags: [标签1, 标签2] # 博客标签
math: true # 是否启用数学公式支持
mermaid: true # 是否启用 Mermaid 图表支持
image:
path: /path/to/image # 博客封面图片路径
alt: 图片描述 # 图片描述
---
然后我找到了written_by和author,但是两个都没用。
然后一路查到了这里。
原来要在_data下新建一个authors.yml。
这世界就是这样,有些人做饭,有些人连饭都不会吃,摸了三圈勺子才用手把饭糊在脸上。
visual studio更换文本编码为UTF-8
我们需要找到高级保存选项,要先
工具 > 自定义 > 命令 这里把高级保存选项放在文件下 菜单栏:文件 添加命令 > 类别:文件 > 高级保存选项 然后就可以在文件 > 高级保存选项 > 编码 > Unicode(UTF-8带签名)-代码页65001
事实证明不够好用,下了个插件。Force UTF-8。
花括号在Jeklly里不能直接使用
用的是Liquid,和Markdown还不太一样。
这种要拿{% raw %}包起来。而且很显然,我现在都不知道要怎么在博客里把endraw包在这个符号里。
参考这里。
UnityEditor.Graphs.Edge.WakeUp ()
报错
Object reference not set to an instance of an object
重启,据说是Unity的bug。