今天遇到一个问题,也是我平时总遇见但是不知道为什么会产生这个问题,今天终于知道了!!!
1.背景:今天ssh远程连接服务器配置环境,我一直在gf的环境安装,结果忙糊涂了,不知道怎么跑到base的环境下安装了(在base环境下安装,一直找不到scipy==1.7.0等的版本号,刚开始pip安装找不到对应的版本号,一开始我以为是根本没有这个版本号,是AI谎报军情!),但是在gf的环境下一下就安装上了,后来问chatgpt和豆包,得出了为什么会产生这个问题的原因)
注:gf(光伏)是自己用anaconda后创建的环境。
2.原因:base环境python版本低,其Python 版本不兼容 scipy1.7.0。所以在搜索包的时候由于版本不兼容不会搜索到scipy 1.7.0的包。安装scipy 1.7.0需要python==3.8.0及之上的版本才能安装scipy 1.7.0,所以gf环境可以搜索到并安装。
3.附一些信息:
(1)base环境安装报错内容如下:
(base) ubuntu@ubuntu-thinkstation:~/桌面/PV_Segmentation$ pip install -i https://pypi.tuna.tsinghua.edu.cn/simple -r requirements.txt
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
ERROR: Ignored the following yanked versions: 1.11.0, 1.14.0rc1
ERROR: Could not find a version that satisfies the requirement scipy==1.7.0 (from versions: 0.8.0, 0.9.0, 0.10.0, 0.10.1, 0.11.0, 0.12.0, 0.12.1, 0.13.0, 0.13.1, 0.13.2, 0.13.3, 0.14.0, 0.14.1, 0.15.0, 0.15.1, 0.16.0, 0.16.1, 0.17.0, 0.17.1, 0.18.0, 0.18.1, 0.19.0, 0.19.1, 1.0.0, 1.0.1, 1.1.0, 1.2.0, 1.2.1, 1.2.2, 1.2.3, 1.3.0, 1.3.1, 1.3.2, 1.3.3, 1.4.0, 1.4.1, 1.5.0, 1.5.1, 1.5.2, 1.5.3, 1.5.4, 1.6.0, 1.6.1, 1.9.2, 1.9.3, 1.11.0rc1, 1.11.0rc2, 1.11.1, 1.11.2, 1.11.3, 1.11.4, 1.12.0rc1, 1.12.0rc2, 1.12.0, 1.13.0rc1, 1.13.0, 1.13.1, 1.14.0rc2, 1.14.0, 1.14.1, 1.15.0rc1, 1.15.0rc2, 1.15.0, 1.15.1, 1.15.2)
ERROR: No matching distribution found for scipy==1.7.0
解释“yanked versions”的含义:
在Rust的包管理器Cargo中,“yanked”是一个术语,用于描述某个版本的包已被其维护者从Cargo索引中移除。尽管这些版本已经从索引中移除,但出于兼容性的考虑,它们不会立即从用户的计算机或Cargo缓存中删除。一个包被“yank”的原因可能包括包含严重的bug、安全问题、违反了许可证条款或其他重要问题。
(2)base环境下pip安装的包:
(base) ubuntu@ubuntu-thinkstation:~/桌面/PV_Segmentation$ pip list
Package Version
------------------------ ---------
anaconda-anon-usage 0.5.0
annotated-types 0.6.0
archspec 0.2.3
boltons 24.1.0
Brotli 1.0.9
certifi 2025.1.31
cffi 1.17.1
charset-normalizer 3.3.2
conda 25.1.1
conda-anaconda-telemetry 0.1.2
conda-anaconda-tos 0.1.2
conda-content-trust 0.2.0
conda-libmamba-solver 25.1.1
conda-package-handling 2.4.0
conda_package_streaming 0.11.0
cryptography 43.0.3
distro 1.9.0
frozendict 2.4.2
idna 3.7
jsonpatch 1.33
jsonpointer 2.1
libmambapy 2.0.5
markdown-it-py 2.2.0
mdurl 0.1.0
menuinst 2.2.0
packaging 24.2
pip 25.0
platformdirs 3.10.0
pluggy 1.5.0
pycosat 0.6.6
pycparser 2.21
pydantic 2.10.3
pydantic_core 2.27.1
Pygments 2.15.1
PySocks 1.7.1
requests 2.32.3
rich 13.9.4
ruamel.yaml 0.18.6
ruamel.yaml.clib 0.2.8
setuptools 75.8.0
tqdm 4.67.1
truststore 0.10.0
typing_extensions 4.12.2
urllib3 2.3.0
wheel 0.45.1
zstandard 0.23.0
(3)gf环境下pip安装的包:
(gf) ubuntu@ubuntu-thinkstation:~/桌面/PV_Segmentation$ pip list
Package Version
------------------ ------------
certifi 2022.12.7
charset-normalizer 2.1.1
cycler 0.12.1
filelock 3.13.1
fsspec 2024.6.1
h5py 2.10.0
idna 3.4
Jinja2 3.1.4
kiwisolver 1.4.7
MarkupSafe 2.1.5
matplotlib 3.1.2
mpmath 1.3.0
networkx 3.0
numpy 1.21.6
opencv-python 4.1.2.30
Pillow 8.2.0
pip 24.2
pyparsing 3.1.4
python-dateutil 2.9.0.post0
requests 2.28.1
scipy 1.7.3
setuptools 75.1.0
six 1.17.0
sympy 1.13.1
torch 2.1.0+cu121
torchaudio 2.1.0+cu121
torchvision 0.16.0+cu121
tqdm 4.60.0
triton 2.1.0
typing_extensions 4.12.2
urllib3 1.26.13
wheel 0.44.0
(4)base环境下python的版本如下:
(base) ubuntu@ubuntu-thinkstation:~/桌面/PV_Segmentation$ python --version
Python 3.12.9
(5)gf环境下python版本如下:
(gf) ubuntu@ubuntu-thinkstation:~/桌面/PV_Segmentation$ python --version
Python 3.8.0
4.补充
(1)pip list 默认只会列出已安装的 第三方包,不会显示 Python 本身的版本。
为什么 pip list 里没有 Python ?
pip list 只显示 pip 管理的包,但 Python 本身不是 pip 安装的,而是系统安装的。
Python 作为运行时环境,pip 只是它的一个包管理工具,pip list 主要管理 安装在 Python 环境中的库,而不是 Python 本身。
如果你想查看 Python 版本,可以使用以下命令:
python --version
或者
python -V
同时查看 pip list 和 Python 版本:
pip list && python --version
或者
pip list | grep python
(2)找不到pip包的原因有很多,比如:
PyPI 或 Conda 源没有该版本(解决方法是换源,或者安装近似版本),环境可能损坏(解决方法是重新安装环境)。
最后如果pip安装不上,可以尝试用conda去安装
conda install scipy=1.7.3
(3)千万不要依赖于一个大语言模型,可以多用几个,比如:文心一言,豆包,chatgpt,deekseek,grok等。因为有点豆包回答的好,有的chatgpt回答的好。这回chatgpt就比豆包回答的具体。
(4)也不要过于依赖大语言模型,有时候CSDN一个经验贴会直击问题要害,而大语言模型是从所有角度分析,可能会偏离真正的原因,从而让你走弯路。如果你在大语言模型中找了一会,试了一下没有解决问题,不妨跳出来,去百度,CSDN,博客园等去寻找方向!
最后附上:2个大语言模型的回答,祝贺大家生活愉快,每天开心!
问AI大模型的原话:
Package Version
------------------------ ---------
anaconda-anon-usage 0.5.0
annotated-types 0.6.0
archspec 0.2.3
boltons 24.1.0
Brotli 1.0.9
certifi 2025.1.31
cffi 1.17.1
charset-normalizer 3.3.2
conda 25.1.1
conda-anaconda-telemetry 0.1.2
conda-anaconda-tos 0.1.2
conda-content-trust 0.2.0
conda-libmamba-solver 25.1.1
conda-package-handling 2.4.0
conda_package_streaming 0.11.0
cryptography 43.0.3
distro 1.9.0
frozendict 2.4.2
idna 3.7
jsonpatch 1.33
jsonpointer 2.1
libmambapy 2.0.5
markdown-it-py 2.2.0
mdurl 0.1.0
menuinst 2.2.0
packaging 24.2
pip 25.0
platformdirs 3.10.0
pluggy 1.5.0
pycosat 0.6.6
pycparser 2.21
pydantic 2.10.3
pydantic_core 2.27.1
Pygments 2.15.1
PySocks 1.7.1
requests 2.32.3
rich 13.9.4
ruamel.yaml 0.18.6
ruamel.yaml.clib 0.2.8
setuptools 75.8.0
tqdm 4.67.1
truststore 0.10.0
typing_extensions 4.12.2
urllib3 2.3.0
wheel 0.45.1
zstandard 0.23.0 这是一个环境,为什么会有这个报错 ERROR: Ignored the following yanked versions: 1.11.0, 1.14.0rc1
ERROR: Could not find a version that satisfies the requirement scipy==1.7.3 (from versions: 0.8.0, 0.9.0, 0.10.0, 0.10.1, 0.11.0, 0.12.0, 0.12.1, 0.13.0, 0.13.1, 0.13.2, 0.13.3, 0.14.0, 0.14.1, 0.15.0, 0.15.1, 0.16.0, 0.16.1, 0.17.0, 0.17.1, 0.18.0, 0.18.1, 0.19.0, 0.19.1, 1.0.0, 1.0.1, 1.1.0, 1.2.0, 1.2.1, 1.2.2, 1.2.3, 1.3.0, 1.3.1, 1.3.2, 1.3.3, 1.4.0, 1.4.1, 1.5.0, 1.5.1, 1.5.2, 1.5.3, 1.5.4, 1.6.0, 1.6.1, 1.9.2, 1.9.3, 1.11.0rc1, 1.11.0rc2, 1.11.1, 1.11.2, 1.11.3, 1.11.4, 1.12.0rc1, 1.12.0rc2, 1.12.0, 1.13.0rc1, 1.13.0, 1.13.1, 1.14.0rc2, 1.14.0, 1.14.1, 1.15.0rc1, 1.15.0rc2, 1.15.0, 1.15.1, 1.15.2)
ERROR: No matching distribution found for scipy==1.7.3
chatgpt回答(未深度思考):
豆包回答(未深度思考):
写于2025.4.3.16:15 over