1.
WARNING: Ignoring invalid distribution -ifffile (c:\programdata\anaconda3\lib\site-packages)
删除以~r开头的文件夹
2.
ERROR: Could not find a version that satisfies the requirement cocomap (from versions: none)
ERROR: No matching distribution found for cocomap
检查拼写和版本号:首先,确保你要安装的库名称拼写正确,并且你指定的版本号是存在的。你可以在PyPI(Python Package Index)上查找库名称和可用版本。
更新pip:如果你的pip版本过旧,可能会无法正常解析库的版本信息。你可以通过以下命令更新pip:
python -m pip install --upgrade pip
使用正确的Python版本:如果你尝试安装的库与你当前使用的Python版本不兼容,你可能需要更换Python版本或者安装与你的Python版本兼容的库版本。你可以使用
python –version 命令查看你的Python版本。
使用虚拟环境:有时候,全局环境中的库冲突可能会导致这个问题。在这种情况下,你可以考虑使用虚拟环境。虚拟环境可以为每个项目创建一个隔离的环境,避免库之间的冲突。你可以基于Conda创建虚拟环境。
查看依赖关系:如果你尝试安装的库有依赖关系,并且这些依赖关系没有满足,这也可能导致这个错误。在这种情况下,你需要先安装依赖的库。
直接下载并安装:如果pip无法找到满足你需求的库版本,你也可以尝试从PyPI直接下载该库的whl文件,然后使用以下命令进行安装:
pip install /path/to/your/downloaded/file.whl
使用不同的镜像源:有时候特定的镜像源可能更快或者有更多你需要的包。你可以尝试更换pip的镜像源进行安装。例如使用清华镜像源:
pip install somepackage -i https://pypi.tuna.tsinghua.edu.cn/simple/
3.
DEPRECATION: pyodbc 4.0.0-unsupported has a non-standard version number. pip 24.1 will enforce this behaviour change. A possible replacement is to upgrade to a newer version of pyodbc or contact the author to suggest that they release a version with a conforming version number. Discussion can be found at Deprecate legacy versions and version specifiers · Issue #12063 · pypa/pip · GitHub
更新distro-info: pip install --upgrade distro-info
4.
ImportError: cannot import name 'notf' from 'tensorboard.compat'
(C:\ProgramData\Anaconda3\Lib\site-packages\tensorboard\compat\__init__.py)
tensorboard.compat库下面确实没有notf,想到可能是版本的问题,高版本后的一些函数可能改名或者删除了,于是我就想Uninstall之前版本的rpds然后装低版本的,浏览器中搜索pip install notf点击第一个链接(rpds-py · PyPI)
5.
Collecting package metadata (current_repodata.json): failed
1.打开Anaconda Prompt,输入下面命令
conda config --show-sources 2.删除.condarc文件
6.
RemoveError: 'setuptools' is a dependency of conda and cannot be removed from
conda's operating environment. 安装setuptools的时候不是采用conda安装的,而是采用pip install的方式安装的,而要安装的包依赖于conda。
先卸载已经安装的setuptools: pip uninstall setuptools
然后再安装,就可以了。
7.
'activate' 不是内部或外部命令,也不是可运行的程序或批处理文件。
再将activate所在的文件夹路径加入到环境变量中即可:例如我的是在D:\Anaconda3\Scripts
然后再在cmd里面再次激活tensdorflow虚拟环境,就可以完美解决了。
8.
AttributeError: module 'PIL.Image' has no attribute 'ANTIALIAS'
法一是修改代码
1.from PIL import Image
2.
3.image = Image.open(r"/home/lx/Desktop/675264194_n.jpg")
4.image = image.resize((20, 20), Image.LANCZOS)
法二是降低版本
pip install Pillow==9.5.0
9.
RuntimeError: Couldn't load custom C++ ops. This can happen if your PyTorch and torchvision versions are incompatible, or if you had errors while compiling torchvision from source. For further information on the compatible versions, check https://github.com/pytorch/vision#installation for the compatibility matrix. Please check your PyTorch version with torch.__version__ and your torchvision version with torchvision.__version__ and verify if they are compatible, and if not please reinstall torchvision so that it matches your PyTorch install.
torch版本和torchvision版本不匹配。我们需要重装torch或者torchvision使得它们版本匹配。点此查看torch和torchvision正确对应版本,看完之后发现自己版本也是对应的啊,为什么会报错呢?这里就是最细节的地方,因为比如我的torch是torch1.11.0+cu111,那么torchvision也得是torchvision0.10.0+cu111,而不是0.10.0。默认安装时很可能没有选择相同版本的安装包导致出错。Pytorch2.0.1 torchvision0.15.2 python3.8 cuda
- 进入https://download.pytorch.org/whl/cu113,分别进入torch和torchvision分支选择版本对应且后缀相同的安装包,然后下载到本地。
V5:torch-1.4.0+cpu-cp38-cp38-win_amd64.whl
torchvision-0.5.0+cpu-cp38-cp38-win_amd64.whl
2、然后卸载已之前的torch和torchvision,pip uninstall torch 和 pip uninstall torchvision
3、whl格式本质上是一个压缩包,里面包含了py文件,以及经过编译的pyd文件。我们切换到安装包的下载目录,然后先
pip install torch-1.4.0+cpu-cp38-cp38-win_amd64.whl后
pip install torchvision-0.5.0+cpu-cp38-cp38-win_amd64.whl
注意,一定要先安装torch,再安装torchvision!如果顺序反过来,它会自动下载torch进行安装,然后版本又不对了,还得卸载了重新安装,我帮你们又踩了下坑。
10.
DLL load failed while importing _C: 找不到指定的模块。
import matplotlib.pyplot as plt 中所有依赖库版本满足要求,但报错的原因是在线pip install numpy时因为在线下载numpy库中缺少DLL
- 在Pycharm的终端输入卸载numpy和matplotlib的命令
- 查看本机的python的版本,在cmd中输入“python”即可
- 在
http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy
下载与本机安装的python版本一致numpy,注意其中符号含义,一定要选择带mkl的numpy
4、将下载的安装包放在Python39-Scripts文件夹下,我的路径参考如下:
C:\Users\wp\AppData\Local\Programs\Python\Python39\Scripts
- 右键点击“我的电脑-属性-高级系统设置-环境变量-系统变量”,在系统变量中找到“path”,点击“编辑”,然后“新建",将上放路径粘贴进去,再一路确定即可
D:\python\ANACONDA\Scripts
- 打开cmd输入
pip install +
上放的路径名
+
下载的文件包的文件名
即可。若显示“Successfully installed numpy-X.XX.X ”即安装成功
7、在cmd中简单验证numpy是否运行成功
python
from numpy
import
*
random.rand
(4,4)
python3.8没有对应的matplotlib怎么办?
办法一:换其他版本的Python,相当于要重新再配个环境,非常麻烦 。
办法二: 如果一定要用Python 3.8的话,可以采用清华源的安装包:
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple matplotlib
这个报错是由于没有安装好相应的模块,或者模块的版本不兼容导致的
1.首先根据报错给出的路径,找到具体的报错的模块
进去python安装文件夹的Lib文件夹内,搜索对应的模块或支持程序
2.进入到模块的文件里,查看所需要用到的模块
import audioop
import cchardet
import sys
比如这个模块所需要的模块是audioop,cchardet,sys
3.直接运行上述程序查看模块是否能够正常运行,如果不能够正常运行,则逐个排查
4.发现是cchardet模块报错,于是首先进行了import cchardet的操作发现已经成功安装,进入Lib文件夹内查找cchardet模块的文件,在https://pypi.org/project/中查找到了已经下载的版本与正在使用的python版本不兼容,最后卸载了当前版本的cchardet,重新下载对应版本后,问题成功解决了!
11.
Error #15: Initializing libiomp5md.dll, but found libiomp5md.dll already initialized.
我在conda里边有很多个环境
删除E:\Anaconda\anacanda3\Library\bin下的这个dll文件。
究其原因其实是,anaconda的环境下存在两个libiomp5md.dll文件。所以直接去虚拟环境的路径下搜索这个文件,可以看到在环境里有两个dll文件:
其中第一个是torch路径下的,第二个是虚拟环境本身路径下的,转到第二个目录下把它剪切到其他路径下备份就好(最好把路径也备份一下)。
12.
OSError: [WinError 1455] 页面文件太小
调大页面文件的大小 + 更改一下batch_size(彻底解决问题)
根本操作只要给D盘分配虚拟内存即可.
1.直接搜索 高级系统设置
2.高级(顶)-性能-设置
3.高级(顶)-虚拟内存-更改
4.取消勾选:自动管理所有驱动器的分页文件大小-D盘-自定义大小-102400-确定