我参与了一个遗留项目的开发,该项目使用python版本3.6.15。我使用 pyenv 安装了这个版本,并创建了这样的虚拟环境:
python -m pip install virtualenv
python -m virtualenv venv
source venv/bin/activate
所以Python版本是正确的。
$ python --version
Python 3.6.15
$ which python
.../venv/bin/python
但是当我尝试从
requirements.txt
安装软件包时,我遇到了这样的问题:
ERROR: Could not find a version that satisfies the requirement anyjson>=0.3.3 (from kombu) (from versions: 0.1, 0.2.0, 0.2.1, 0.2.2, 0.2.3, 0.2.4, 0.2.5, 0.3, 0.3.1, 0.3.2, 0.3.3)
ERROR: No matching distribution found for anyjson>=0.3.3
找不到软件包版本,但软件包版本在
from version:
部分列出。这种情况在多种情况下都会发生。但在使用 docker.io/library/python:3.6.15
作为基础的 Docker 镜像中,一切都安装成功。这种行为可能存在什么问题?
操作系统:Ubuntu 22.04
我确实使用 Python 3.6.15 在 Debian 上安装
anyjson>=0.3.3
并收到此错误
error in anyjson setup command: use_2to3 is invalid.
除了
ERROR: Could not find a version that satisfies the requirement anyjson>=0.3.3 (from versions: 0.1, 0.2.0, 0.2.1, 0.2.2, 0.2.3, 0.2.4, 0.2.5, 0.3, 0.3.1, 0.3.2, 0.3.3)
ERROR: No matching distribution found for anyjson>=0.3.3
所以我修复了第一个错误
pip install --upgrade "setuptools>58"
(在 https://stackoverflow.com/a/69100830/7976758 、https://stackoverflow.com/search?q=%5Bpip%5D+error+in+setup+command%3A+use_2to3+ 中找到是+无效)
然后重试:
$ pip install -U "anyjson>=0.3.3"
Collecting anyjson>=0.3.3
Using cached anyjson-0.3.3.tar.gz (8.3 kB)
Preparing metadata (setup.py) ... done
Building wheels for collected packages: anyjson
Building wheel for anyjson (setup.py) ... done
Created wheel for anyjson: filename=anyjson-0.3.3-py3-none-any.whl size=4972 sha256=fe5c1891804ad1273afdd3a3763140bcd97b933e585fa66044770da9443dc561
Stored in directory: /home/phd/.cache/pip/wheels/b9/bd/95/00661ac6fe3bc60296ccb45e91518eb6b57c905fd077177aeb
Successfully built anyjson
Installing collected packages: anyjson
Successfully installed anyjson-0.3.3
PS。底线:始终向我们显示错误的完整文本 留言。