配置利用神经网络进行图片分类的某Python程序的运行环境记录(上)

因为要用到GPU,所以首先要装好CUDA,CUDA已经装好了,详情见下面这篇博文:
https://blog.csdn.net/wenhao_ir/article/details/125253533

接下来利用Pip装好下面的些扩展包:

扩展包功能
numpy数值计算扩展库,用来存储和处理大型矩阵
scipy在Numpy库的基础上增加了常用的库函数
matplotlibPython的2D绘图库
scikit-learn集成了多种分类和聚类算法的Python工具包
skimagePython下的图像处理库
tensorflowGoogle开发的深度学习框架
tflearn对Tensorflow接口进行了更高层次封装的工具包
PILPython图形处理库

关于最后一个PIL要说明的是,PIL(Python Imaging Library)是Python中一个强大的图像处理库,但目前其只支持到Python2.7。也就是说要想使用它,只能把Python版本降到Python2.7。如果想要用它,可以用pillow替代,pillow是PIL的一个分支,虽是分支但是其与PIL同样也具有很强的图像处理库。

不过话说回来,为什么我在Python3.6下发现PIL呢?如下图所示:
在这里插入图片描述
所以后边以后在别的Python版本中准备安装PIL时,可以先看下它是否已经存在了。

接下来,一个一个地装吧~

博主注:请大家直接拉到本文末尾看,整个过程比较曲折,并且以失败告终,原因是自己的Python版本太低了(我目前用的是3.6.8版),所以需要重新更换Python的高版本(准备更新到3.9.10版)再来安装以上扩展库。

01-安装numpy

numpy已经装了,详情见 https://blog.csdn.net/wenhao_ir/article/details/123014519

02-安装scipy

scipy没有装,安装一下。

pip install scipy

在这里插入图片描述
速度有点慢,先去跑个步吧~
跑完步回来一看,报错了…
在这里插入图片描述
看这情况是与源的连接不畅导致的下载失败啊…
那就直接用上面的下载链接挂梯子下载吧!
https://files.pythonhosted.org/packages/f3/9f/80522344838ae24cac9e945240436269cbb92349f7f1f4c9dfc10cb6bad5/scipy-1.5.4-cp36-cp36m-win_amd64.whl
在这里插入图片描述
挂上梯子这速度就不一样了。
在这里插入图片描述
为了以后二次安装的方便,把文件scipy-1.5.4-cp36-cp36m-win_amd64.whl上传到百度网盘,百度网盘下载链接:
https://pan.baidu.com/s/1EgiuhICzEcWWaIXBMdEVeA?pwd=t74v
下载好之后运行下面三条命令安装scipy-1.5.4。

cd F:\Download
F:
pip install scipy==1.5.4

如下图所示:
在这里插入图片描述
在这里插入图片描述
从上面的截图来看,下载速度就很快了,原因在于它实际上是从本地下载到本地,相当于是一个本地复制,当然很快了。
从上面的截图我们还可以看出安装成功了。
再来看目录:
C:\Users\Administrator\AppData\Local\Programs\Python\Python36\Lib\site-packages
里面有scipy了,说明安装成功了,截图如下:
在这里插入图片描述

03 安装matplotlib

matplotlib也已经安装了,详情见 https://blog.csdn.net/wenhao_ir/article/details/123014519

04 安装scikit-learn

pip install scikit-learn

同样速度很慢,不过还好文件比较小,等几分钟而已。
scikit_learn-0.24.2-cp36-cp36m-win_amd64.whl文件下载链接:
https://files.pythonhosted.org/packages/1e/37/57198cbb6ea88b20f78dc6019296ebf2ada76fa258ad010452f7c91d43f7/scikit_learn-0.24.2-cp36-cp36m-win_amd64.whl
同样上传到百度网盘和CSDN上。
CSDN下载地址:https://download.csdn.net/download/wenhao_ir/85629192
在这里插入图片描述

05 安装scikit-image

pip install scikit-image

在这里插入图片描述
imageio 2.16.0 has requirement numpy>=1.20.0, but you’ll have numpy 1.19.5 which is incompatible.
Successfully installed PyWavelets-1.1.1 decorator-4.4.2 imageio-2.16.0 networkx-2.5.1 scikit-image-0.17.2 tifffile-2020.9.3
虽然上面的截图显示安装成功了,但是我的numpy版本不能满足imageio 2.16.0 的要求,所以我需要先卸载目前的numpy,再装一个最新的numpy。

pip uninstall numpy==1.19.5

在这里插入图片描述

pip install numpy==1.20.0

居然源里没有1.20.0以上版本。
在这里插入图片描述
这个原因应该是我的Python版本低了,Python3.7以上应该才有,原因见下面的截图:
在这里插入图片描述
考虑一下,比较折中的方法应该是降低imageio的版本,用低一点的版本。它的可用版本号如下:

C:\Users\Administrator>pip install imageio==100.0
Collecting imageio==100.0
  Could not find a version that satisfies the requirement imageio==100.0 (from versions: 1.1-linux32, 1.1-linux64, 1.1-osx64, 1.1-win32, 1.1-win64, 1.2-linux32, 1.2-linux64, 1.2-osx64, 1.2-win32, 1.2-win64, 1.3-linux32, 1.3-linux64, 1.3-osx64, 1.3-win32, 1.3-win64, 0.2.1, 0.2.2, 0.2.3, 0.3.0, 0.3.1, 0.3.2, 0.4, 0.4.1, 0.5, 0.5.1, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 2.0.0, 2.0.1, 2.1.0, 2.1.1, 2.1.2, 2.2.0, 2.3.0, 2.4.0, 2.4.1, 2.5.0, 2.6.0, 2.6.1, 2.8.0, 2.9.0, 2.10.1, 2.10.2, 2.10.3, 2.10.4, 2.10.5, 2.11.0, 2.11.1, 2.12.0, 2.13.0, 2.13.1, 2.13.2, 2.13.3, 2.13.4, 2.13.5, 2.14.0, 2.14.1, 2.15.0, 2.16.0)
No matching distribution found for imageio==100.0

我们安装一个中间的版本,就2.0.0吧~

我们用下面几条命令先卸载刚才安装的scikit-image及其相关库。

pip uninstall scikit-image==0.17.2
pip uninstall tifffile==2020.9.3
pip uninstall networkx==2.5.1
pip uninstall imageio==2.16.0
pip uninstall decorator==4.4.2
pip uninstall PyWavelets==1.1.1

卸载完成后重新先安装imageio==2.0.0

pip install imageio==2.0.0

然后把scikit-imag也降点版本,先看下可用版本有哪些:

pip install scikit-image==100.0
C:\Users\Administrator>pip install scikit-image==100.0
Collecting scikit-image==100.0
  Could not find a version that satisfies the requirement scikit-image==100.0 (from versions: 0.7.2, 0.8.0, 0.8.1, 0.8.2, 0.9.0, 0.9.1, 0.9.3, 0.10.0, 0.10.1, 0.11.2, 0.11.3, 0.12.0, 0.12.1, 0.12.2, 0.12.3, 0.13.0, 0.13.1, 0.14.0, 0.14.1, 0.14.2, 0.14.3, 0.14.4, 0.14.5, 0.15.0, 0.16.1, 0.16.2, 0.17.1, 0.17.2)
No matching distribution found for scikit-image==100.0

用0.14.0吧

pip install scikit-image==0.14.0

这个没有问题成功安装了~

Successfully installed PyWavelets-1.1.1 cloudpickle-2.1.0 dask-2021.3.0 decorator-4.4.2 networkx-2.5.1 pyyaml-6.0 scikit-image-0.14.0 toolz-0.11.2

06-安装tensorflow

pip install tensorflow

tensorflow是真心大啊~
在这里插入图片描述
还好下载速度挺快的,但是问题就是需要python 3.7啊~
在这里插入图片描述
从第05个的曲折过程来看,正确的方法是把自己系统中的Python版本换成3.7的…
不过既然到这里了,我们还是尝试下降低版本吧!
看下tensorflow有哪些版本~

pip install tensorflow==100
C:\Users\Administrator>pip install tensorflow==100
Collecting tensorflow==100
  Could not find a version that satisfies the requirement tensorflow==100 (from versions: 1.2.0, 1.2.1, 1.3.0, 1.4.0, 1.5.0, 1.5.1, 1.6.0, 1.7.0, 1.7.1, 1.8.0, 1.9.0, 1.10.0, 1.11.0, 1.12.0, 1.12.2, 1.12.3, 1.13.1, 1.13.2, 1.14.0, 1.15.0, 1.15.2, 1.15.3, 1.15.4, 1.15.5, 2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.1.0, 2.1.1, 2.1.2, 2.1.3, 2.1.4, 2.2.0, 2.2.1, 2.2.2, 2.2.3, 2.3.0, 2.3.1, 2.3.2, 2.3.3, 2.3.4, 2.4.0, 2.4.1, 2.4.2, 2.4.3, 2.4.4, 2.5.0, 2.5.1, 2.5.2, 2.6.0rc0, 2.6.0rc1, 2.6.0rc2, 2.6.0, 2.6.1, 2.6.2)
No matching distribution found for tensorflow==100

用2.0.0吧!

pip install tensorflow==2.0.0

在这里插入图片描述
tensorflow==2.0.0只有48.1M,还好~
还是一样的报错,需要Python3.7以上~

所以到这里,为了避免将来的各种麻烦,我的明智之选是把Python版本升高,到Python官网
https://www.python.org/ftp/python/)
一看,都已经到3.9.13版了,所以我觉得更新到3.9.10是明智之举,那接下来将系统中的Python由3.6.8更换到3.9.10版本,3.6.8的发行时间是24-Dec-2018 08:27 ,时间的确是有点久了,用这个版本不利于我将来的各种开发。
具体的我更新到3.9.10版,它的更新时间为17-Jan-2022 15:50 。

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值