当前位置:   article > 正文

最全【Stable Diffusion安装】支持python3,2024大厂Python春招面试经历_python 安装duffusion

python 安装duffusion

在这里插入图片描述

感谢每一个认真阅读我文章的人,看着粉丝一路的上涨和关注,礼尚往来总是要有的:

① 2000多本Python电子书(主流和经典的书籍应该都有了)

② Python标准库资料(最全中文版)

③ 项目源码(四五十个有趣且经典的练手项目及源码)

④ Python基础入门、爬虫、web开发、大数据分析方面的视频(适合小白学习)

⑤ Python学习路线图(告别不入流的学习)

网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。

需要这份系统化学习资料的朋友,可以戳这里获取

一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!

我下载的是guofeng3
下载后,存放路径:
在这里插入图片描述

如果出现pip已经下载的模块,但是识别不了的情况下,修改pyvenv.cfg文件

路径E:\openai\project\stable-diffusion-webui\venv,这个需要启动webui-user.bat才会产生。

E:\openai\project\stable-diffusion-webui\venv

  • 1
  • 2

这个venv是需要运行webui-user.bat文件后才会产生的。
在这里插入图片描述
下面是我的pyvenv.cfg文件内容

home = D:\Program Files\Python
include-system-site-packages = true
version = 3.11.2
executable = D:\Program Files\Python\python.exe
command = D:\Program Files\Python\python.exe -m venv E:\openai\project\stable-diffusion-webui\venv

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

include-system-site-packages 这个参数可以设置是否开启“引用系统中的模块”的功能。如果开启了,那么我们就可以直接使用系统中已经装过的第三方模块。(但是你在虚拟环境下装的模块就不能被其他地方的程序使用)

双击运行webui-user.bat文件

该文件是以后每次运行启动文件。

启动时,遇到的各种问题,下面会单独讲解。

在这里插入图片描述

启动页命令框里,看到:Running on local URL: http://127.0.0.1:7860,表示启动成功。
http://127.0.0.1:7860,放入浏览器里执行,就OK了。

页面长这个样子:
在这里插入图片描述

以后每次运行程序:双击运行webui-user.bat文件即可。

遇到的问题

pip 安装失败,万能解决办法 – 手动安装

正常情况下,当我们遇到pip安装失败的情况下,单独执行,下面的语句是没有问题的:

# 这种总是安装失败时
pip install https://github.com/TencentARC/GFPGAN/archive/8d2447a2d918f8eba5a4a01463fd48e45126a379.zip --prefer-binary

  • 1
  • 2
  • 3

但是如果遇到总是安装失败的情况下,这时,我们就需要手动安装了:

比如,我们现在遇到安装:antlr4-python3-runtime==4.9.3无法自动安装的情况。
这时,我们就去官网下载:https://pypi.org/project/antlr4-python3-runtime/4.9.3/

把文件下载下来:

在这里插入图片描述
然后将下载下来的包,解压到:E:\openai\project\stable-diffusion-webui\venv\Scripts\路径下。

接着在cmd中执行python3 setup.py build install
具体我执行的命令:

E:\openai\project\stable-diffusion-webui\venv\Scripts\antlr4-python3-runtime-4.9.3>e:\openai\project\stable-diffusion-webui\venv\Scripts\python.exe setup.py build install

  • 1
  • 2

RuntimeError: Couldn’t install torch.

错误信息:

E:\openai\project\stable-diffusion-webui\venv\Scripts\python.exe: No module named pip
Traceback (most recent call last):
  File "E:\openai\project\stable-diffusion-webui\launch.py", line 39, in <module>
    main()
  File "E:\openai\project\stable-diffusion-webui\launch.py", line 30, in main
    prepare\_environment()
  File "E:\openai\project\stable-diffusion-webui\modules\launch\_utils.py", line 311, in prepare_environment
    run(f'"{python}" -m {torch\_command}', "Installing torch and torchvision", "Couldn't install torch", live=True)
  File "E:\openai\project\stable-diffusion-webui\modules\launch\_utils.py", line 113, in run
    raise RuntimeError("\n".join(error_bits))
RuntimeError: Couldn't install torch.
Command: "E:\openai\project\stable-diffusion-webui\venv\Scripts\python.exe" -m pip install torch==2.0.1 torchvision==0.15.2 --extra-index-url https://download.pytorch.org/whl/cu118
Error code: 1

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14

在这里插入图片描述

解决办法

# 在cmd窗口中执行如下命令即可:
pip install torch==2.0.1 torchvision==0.15.2 --extra-index-url https://download.pytorch.org/whl/cu118

  • 1
  • 2
  • 3

RuntimeError: Torch is not able to use GPU;

错误信息:

venv "E:\openai\project\stable-diffusion-webui\venv\Scripts\Python.exe"
fatal: No names found, cannot describe anything.
Python 3.11.2 (tags/v3.11.2:878ead1, Feb  7 2023, 16:38:35) [MSC v.1934 64 bit (AMD64)]
Version: 1.5.1
Commit hash: 68f336bd994bed5442ad95bad6b6ad5564a5409a
Traceback (most recent call last):
  File "E:\openai\project\stable-diffusion-webui\launch.py", line 39, in <module>
    main()
  File "E:\openai\project\stable-diffusion-webui\launch.py", line 30, in main
    prepare_environment()
  File "E:\openai\project\stable-diffusion-webui\modules\launch\_utils.py", line 314, in prepare_environment
    raise RuntimeError(
RuntimeError: Torch is not able to use GPU; add --skip-torch-cuda-test to COMMANDLINE_ARGS variable to disable this check

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14

在这里插入图片描述

解决办法

这说明需要安装cuda。上面有安装教程。

RuntimeError: Couldn’t install gfpgan.

错误信息:

Version: 1.5.1
Commit hash: 68f336bd994bed5442ad95bad6b6ad5564a5409a
Installing gfpgan
Traceback (most recent call last):
  File "E:\openai\project\stable-diffusion-webui\launch.py", line 39, in <module>
    main()
  File "E:\openai\project\stable-diffusion-webui\launch.py", line 30, in main
    prepare_environment()
  File "E:\openai\project\stable-diffusion-webui\modules\launch\_utils.py", line 320, in prepare_environment
    run_pip(f"install {gfpgan\_package}", "gfpgan")
  File "E:\openai\project\stable-diffusion-webui\modules\launch\_utils.py", line 136, in run_pip
    return run(f'"{python}" -m pip {command} --prefer-binary{index\_url\_line}', desc=f"Installing {desc}", errdesc=f"Couldn't install {desc}", live=live)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\openai\project\stable-diffusion-webui\modules\launch\_utils.py", line 113, in run
    raise RuntimeError("\n".join(error_bits))
RuntimeError: Couldn't install gfpgan.
Command: "E:\openai\project\stable-diffusion-webui\venv\Scripts\python.exe" -m pip install https://github.com/TencentARC/GFPGAN/archive/8d2447a2d918f8eba5a4a01463fd48e45126a379.zip --prefer-binary
Error code: 1
stdout: Collecting https://github.com/TencentARC/GFPGAN/archive/8d2447a2d918f8eba5a4a01463fd48e45126a379.zip
  Downloading https://github.com/TencentARC/GFPGAN/archive/8d2447a2d918f8eba5a4a01463fd48e45126a379.zip (6.0 MB)
     ---------------------------------------- 6.0/6.0 MB 43.6 kB/s eta 0:00:00
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'

stderr: ERROR: No .egg-info directory found in C:\Users\yutao\AppData\Local\Temp\pip-pip-egg-info-6ubqppke

  • 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

在这里插入图片描述

解决办法

本质上就是连不上网,所以需要开代理,并配置代理,只要按照上面来,就没问题。

RuntimeError: Couldn’t install clip.

Version: 1.5.1
Commit hash: 68f336bd994bed5442ad95bad6b6ad5564a5409a
Installing clip
Traceback (most recent call last):
  File "E:\openai\project\stable-diffusion-webui\launch.py", line 39, in <module>
    main()
  File "E:\openai\project\stable-diffusion-webui\launch.py", line 30, in main
    prepare_environment()
  File "E:\openai\project\stable-diffusion-webui\modules\launch\_utils.py", line 323, in prepare_environment
    run_pip(f"install {clip\_package}", "clip")
  File "E:\openai\project\stable-diffusion-webui\modules\launch\_utils.py", line 136, in run_pip
    return run(f'"{python}" -m pip {command} --prefer-binary{index\_url\_line}', desc=f"Installing {desc}", errdesc=f"Couldn't install {desc}", live=live)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\openai\project\stable-diffusion-webui\modules\launch\_utils.py", line 113, in run
    raise RuntimeError("\n".join(error_bits))
RuntimeError: Couldn't install clip.
Command: "E:\openai\project\stable-diffusion-webui\venv\Scripts\python.exe" -m pip install https://ghproxy.com/https://github.com/openai/CLIP/archive/d50d76daa670286dd6cacf3bcd80b5e4823fc8e1.zip --prefer-binary
Error code: 1
stdout: Collecting https://ghproxy.com/https://github.com/openai/CLIP/archive/d50d76daa670286dd6cacf3bcd80b5e4823fc8e1.zip
  Downloading https://ghproxy.com/https://github.com/openai/CLIP/archive/d50d76daa670286dd6cacf3bcd80b5e4823fc8e1.zip (4.3 MB)
     ---------------------------------------- 4.3/4.3 MB 2.3 MB/s eta 0:00:00
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'

stderr: ERROR: No .egg-info directory found in C:\Users\yutao\AppData\Local\Temp\pip-pip-egg-info-w8i73o1w

  • 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

在这里插入图片描述

解决办法

先试试:

pip install https://ghproxy.com/https://github.com/openai/CLIP/archive/d50d76daa670286dd6cacf3bcd80b5e4823fc8e1.zip --prefer-binary

  • 1
  • 2

如果不行,就手动安装:

  1. https://github.com/openai/CLIP 下载
  2. 把压缩文件解压到xxx\stable-diffusion-webui\venv\Scripts
  3. 打开clip-main文件夹,在上方红框的路径地址栏里输入CMD,进入clip-main路径下的cmd命令提示符界面
    在这里插入图片描述
  4. cmd中执行:python.exe setup.py build install

特别注意,python.exe要是你自己的路径。

stable diffusion本地安装部署提示clip安装失败的解决方法

下载:https://github.com/openai/CLIP

输入xxx\stable-diffusion-webui\venv\Scripts\python.exe -m pip install ftfy regex tqdm 安装clip依赖

输入xxx\stable-diffusion-webui\venv\Scripts\python.exe setup.py build install

  • 1
  • 2
  • 3
  • 4

安装jsonmerge==1.8.0 报错

这种情况下,就执行pip install jsonmerge安装最新版即可。
安装好后,注意cmd中打印的版本信息,比如我安装完后的版本号jsonmerge==1.9.2
这时需要修改下文件:
在这里插入图片描述

jsonmerge==1.8.0 修改为:jsonmerge==1.9.2

jsonmerge==1.9.2

  • 1
  • 2

参考地址:

Python pip 源设置成国内源,阿里云源,清华大学源

https://civitai.com/models/10415/3-guofeng3

Antlr4-python3-runtime在ubuntu上的安装

stable diffusion本地安装部署提示clip安装失败的解决方法

做了那么多年开发,自学了很多门编程语言,我很明白学习资源对于学一门新语言的重要性,这些年也收藏了不少的Python干货,对我来说这些东西确实已经用不到了,但对于准备自学Python的人来说,或许它就是一个宝藏,可以给你省去很多的时间和精力。

别在网上瞎学了,我最近也做了一些资源的更新,只要你是我的粉丝,这期福利你都可拿走。

我先来介绍一下这些东西怎么用,文末抱走。


(1)Python所有方向的学习路线(新版)

这是我花了几天的时间去把Python所有方向的技术点做的整理,形成各个领域的知识点汇总,它的用处就在于,你可以按照上面的知识点去找对应的学习资源,保证自己学得较为全面。

最近我才对这些路线做了一下新的更新,知识体系更全面了。

在这里插入图片描述

(2)Python学习视频

包含了Python入门、爬虫、数据分析和web开发的学习视频,总共100多个,虽然没有那么全面,但是对于入门来说是没问题的,学完这些之后,你可以按照我上面的学习路线去网上找其他的知识资源进行进阶。

在这里插入图片描述

(3)100多个练手项目

我们在看视频学习的时候,不能光动眼动脑不动手,比较科学的学习方法是在理解之后运用它们,这时候练手项目就很适合了,只是里面的项目比较多,水平也是参差不齐,大家可以挑自己能做的项目去练练。

在这里插入图片描述

(4)200多本电子书

这些年我也收藏了很多电子书,大概200多本,有时候带实体书不方便的话,我就会去打开电子书看看,书籍可不一定比视频教程差,尤其是权威的技术书籍。

基本上主流的和经典的都有,这里我就不放图了,版权问题,个人看看是没有问题的。

(5)Python知识点汇总

知识点汇总有点像学习路线,但与学习路线不同的点就在于,知识点汇总更为细致,里面包含了对具体知识点的简单说明,而我们的学习路线则更为抽象和简单,只是为了方便大家只是某个领域你应该学习哪些技术栈。

在这里插入图片描述

(6)其他资料

还有其他的一些东西,比如说我自己出的Python入门图文类教程,没有电脑的时候用手机也可以学习知识,学会了理论之后再去敲代码实践验证,还有Python中文版的库资料、MySQL和HTML标签大全等等,这些都是可以送给粉丝们的东西。

在这里插入图片描述

这些都不是什么非常值钱的东西,但对于没有资源或者资源不是很好的学习者来说确实很不错,你要是用得到的话都可以直接抱走,关注过我的人都知道,这些都是可以拿到的。

网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。

需要这份系统化学习资料的朋友,可以戳这里获取

一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!

声明:本文内容由网友自发贡献,转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号