
qa
Xavier Jiezou
这个作者很懒,什么都没留下…
展开
-
【Linux】The virtual environment was not created successfully because ensurepip is not available.
在 Ubuntu 系统上使用 Python3.8 创建虚拟环境时报错:解决方案报错信息中其实已经给了解决方案:当然,如果你不是 root 用户,得加上 sudo:但还是报错:这个是因为 apt 好久没有更新了,更新一下:更新之后继续安装:完美解决!...原创 2022-06-15 21:21:58 · 2852 阅读 · 0 评论 -
键盘输入时只按了一次,却出现好几个字母(Fn+F10关闭加速)
问题描述键盘随便按下一个字母 j,却连续出现了好几个:jjjjjjjj原因分析可能是开启了键盘的加速效果。解决方案一般按 Fn+F10 即可关闭加速。(如果仍然无法解决,请咨询键盘厂商)引用参考https://tieba.baidu.com/f?kz=4878044483拓展阅读如果键盘上的 Win 键无法使用,可以通过 Fn+Win 开启。(如果你键盘上有两个 Win 键,Fn+左 Win是关闭 Win 功能,Fn+右 Win 是开启 Win 功能;有些键盘还会有图标提示,带🔒的转载 2022-05-29 13:49:29 · 53999 阅读 · 2 评论 -
TypeError: Descriptors cannot not be created directly. If this call came from a _pb2.py file……
问题描述TypeError: Descriptors cannot not be created directly. If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0. If you cannot immediately regenerate your protos, some other possible wo原创 2022-05-27 09:27:53 · 22037 阅读 · 22 评论 -
Warning: find_unused_parameters=True was specified in DDP constructor……
项目场景使用 Pytorch Lightning 训练模型。问题描述Warning: find_unused_parameters=True was specified in DDP constructor, but did not find any unused parameters. This flag results in an extra traversal of the autograd graph every iteration, which can adversely affect pe原创 2022-05-27 00:14:33 · 8475 阅读 · 0 评论 -
Jsdelivr CDN 加速服务又被 DNS 污染了(附临时解决方案)
近两天写博客的时候发现 Jsdelivr 的 CDN 加速服务用不了,具体表现为添加 Jsdelivr CDN 的链接无法访问。这里给个例子:GitHub 图片原链接(访问有点慢)https://raw.githubusercontent.com/XavierJiezou/ys-dl/main/image/favicon.ico添加 Jsdelivr CDN 加速后的链接(提高 GitHub 静态资源的访问速度)https://cdn.jsdelivr.net/gh/XavierJi原创 2022-05-18 16:12:51 · 12128 阅读 · 32 评论 -
【Git】 SSL certificate problem: unable to get local issuer certificate
项目场景使用 git clone 命令从 GitHub 克隆一个仓库到本地:git clone https://github.com/XavierJiezou/ys-dl.git问题描述$ git clone https://github.com/XavierJiezou/ys-dl.gitCloning into 'ys-dl'...fatal: unable to access 'https://github.com/XavierJiezou/ys-dl.git/': SSL certif原创 2022-05-16 14:32:49 · 1759 阅读 · 1 评论 -
ERROR: Can not perform a ‘--user‘ install. User site-packages are not visible in this virtualenv.
项目场景新建了一个 Python 虚拟环境,但在虚拟环境里面使用 pip 安装包时却遇到了错误。问题描述使用命令 pip install requests 安装包时报错信息如下:ERROR: Can not perform a '--user' install. User site-packages are not visible in this virtualenv.原因分析因为在虚拟环境中找不到用户目录,所以不被允许使用 --user 参数来安装包的。但我安装的时候也没指定 --user原创 2022-05-08 09:31:31 · 16321 阅读 · 3 评论 -
记录 Poetry 发布包到 pypi 遇到的坑:No suitable keyring backends were found
项目场景使用 Poetry 开发一个 Python 项目。在本地可以正常使用 poetry build 构建包,然后使用 poetry publish 将包发布到 pypi 官网。但是当我将其部署到 GitHub Actions 时,可以正常构建包,但发布包时却遇到了如下问题。问题描述包构建成功了,发布到 pypi 时报错:No suitable keyring backends were found这是我配置工作流的代码:- name: Publish to PyPI e原创 2022-05-04 08:45:59 · 994 阅读 · 0 评论 -
fatal: refusing to merge unrelated histories
项目场景笔者在 GitHub 上创建了一个仓库作为 git 的远程库,并创建了一个 PR,完成了一个提交与合并操作。笔者在本地使用 git init 命令也创建了一个同名库,增加了一些文件,现想将本地库的文件与远程库进行合并。问题描述首先,使用 git remote add 命令将远程库与本地库绑定git remote add origin https://github.com/XavierJiezou/NetSMorigin:指定 origin 作为远程库的别名(远程库的链接那么长,我们不原创 2022-05-01 23:29:56 · 1640 阅读 · 1 评论 -
ERROR: Could not find a version that satisfies the requirement xxx (from versions: none)
项目场景$ pip install netsmERROR: Could not find a version that satisfies the requirement netsm (from versions: none)ERROR: No matching distribution found for netsm原创 2022-04-29 08:39:55 · 10147 阅读 · 3 评论 -
记录初次使用 Python 的 Poetry 库遇到的一个坑(安装第三方包时卡住)
项目场景使用 poetry new demo 新建一个项目后,想安装一个依赖包 requests。问题描述但一直卡在如下页面,没有任何反应:$ poetry add requestsCreating virtualenv demo-znJHNgUV-py3.9 in C:\Users\87897\AppData\Local\pypoetry\Cache\virtualenvsUsing version ^2.27.1 for requestsUpdating dependenciesRes原创 2022-04-24 23:04:40 · 8267 阅读 · 0 评论 -
【Python】如何使用matplotlib 库正确的显示灰度图像
项目场景我这里有一张名为 camera.jpg 的灰度图像:使用 matplotlib 库读取并显示:import matplotlib.pyplot as pltplt.imshow(plt.imread('camera.jpg'))plt.show()显示结果如下:问题描述如上图,显示的是绿色的图片,而我这里想让它显示原图的那种黑白色调。怎么实现呢?原因分析根据官方文档可知:matplotlib.pyplot.imshow 有一个 cmap 参数,用该参数来控制图像显示原创 2022-04-22 21:36:47 · 11817 阅读 · 1 评论 -
为什么开了代理,git push 还是很慢或报错
问题描述从本地提交代码到 GitHub 远程仓库,由于 DNS 污染的问题,国内提交速度很慢,有时候还报错。笔者自己花钱买了一个梯子,但开启梯子的代理后仍然没有解决问题,不过 Google 等倒是可以访问了。原因分析虽然开启了代理,但可能 git push 并没有走代理,因为需要在 git 里面进行配置。解决方法配置 git push 直接走网络代理:git config --global http.proxy socks5://127.0.0.1:1080git config --globa转载 2022-04-21 21:48:27 · 5469 阅读 · 0 评论 -
记录 Beautiful Soup 库的一个坑(获取标签内的文本字符串内容时需要注意空格)
项目场景Beautiful Soup 是一个可以从 HTML 或 XML 文件中提取数据的第三方 Python 库,通常在网络爬虫项目中使用。今天,笔者在使用过程中遇到了一个坑,在此记录,并将解决方案分享给大家。问题描述参考官方文档可知:如果标签里面只有一个子节点,使用 .string 方法可以获得标签内的文本内容。但是,运行下列代码的输出结果却分别是 None 和 ZXC's Blog。from bs4 import BeautifulSouphtml = '''<p> <原创 2022-04-18 14:46:39 · 1376 阅读 · 0 评论 -
解决 Pyspider 在 Windows 系统上安装报错的问题
问题描述Pyspider 在 Windows 系统上直接通过 pip install pyspider 安装报错: ERROR: Command errored out with exit status 10: command: 'C:\ProgramData\Miniconda3\python.exe' -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\87897\\AppData\\Loc原创 2022-04-17 10:16:07 · 4422 阅读 · 0 评论 -
AttributeError: module ‘pexpect‘ has no attribute ‘spawn‘
问题描述Windows 系统上安装了一个 Python 的第三方包 pexpect,调用包函数的时候报错。>>> import pexpect>>> pexpect.spawn('ping baidu.com')Traceback (most recent call last): File "<stdin>", line 1, in <module>AttributeError: module 'pexpect' has no att原创 2022-04-15 13:30:50 · 2349 阅读 · 0 评论 -
ValueError: Mime type rendering requires nbformat>=4.2.0 but it is not installed
项目场景使用 Python 的 plotly 库进行可视化绘图:import plotly.express as pxfig = px.bar(x=['a', 'b', 'c'], y=[1, 3, 2])fig.show()问题描述运行代码报错:ValueError: Mime type rendering requires nbformat>=4.2.0 but it is not installed解决方案更新 nbformat 库:pip install --upgra原创 2022-04-12 09:48:10 · 9244 阅读 · 3 评论 -
解决 VSCode 无法连接远程服务器,一直 Retry 的问题
问题描述使用 VSCode 的插件 Remote - SSH 连接远程服务器,之前一直好好的,不知道为什么今天连不上了,一直显示 Retry(重试)。PING 了一下远程服务器的 IP,发现可以 PING 通,没什么问题。解决方案打开命令面板执行命令 Remote-SSH: Kill VS Code Server on Host…3. 选择一直连不上的服务器的 IP 即可引用参考https://www.cnblogs.com/zuozhengjun/p/15570053.html转载 2022-04-09 12:03:46 · 11528 阅读 · 3 评论 -
CommandNotFoundError: Your shell has not been properly configured to use ‘conda activate‘
问题描述用 conda 创建了一个新环境,无法激活,报错信息如下。$ conda activate env_nameCommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.If using 'conda activate' from a batch script, change yourinvocation to 'CALL conda.bat activate'.To原创 2022-03-30 23:11:26 · 863 阅读 · 0 评论 -
无法加载文件C:\Users\xxx\Documents\WindowsPowerShell\profile.ps1,因为在此系统上禁止运行脚本
问题描述打开 PowerShell 提示如下报错信息。Windows PowerShell版权所有(C) Microsoft Corporation。保留所有权利。安装最新的 PowerShell,了解新功能和改进!https://aka.ms/PSWindows. : 无法加载文件 C:\Users\87897\Documents\WindowsPowerShell\profile.ps1,因为在此系统上禁止运行脚本。有关详细信息,请参阅 https:/go.microsoft.com/f转载 2022-03-30 23:01:32 · 47922 阅读 · 13 评论 -
【Git】Logon failed, use ctrl+c to cancel basic credential prompt.
问题描述用 git 推送代码变更的时候一直提示登录 github,输入正确的用户名和密码后仍提示错误,错误日志如下:Logon failed, use ctrl+c to cancel basic credential prompt.remote: Repository not found.fatal: Authentication failed for 'https://github.com/XavierJiezou/opencv-chinese-flag.git/'从日志里面其实也看不出什么原创 2021-11-17 00:34:06 · 1064 阅读 · 0 评论