我已经为我的project1安装了kafka包和1.2.0版本,当我安装project2 1.3.0版本时,以前的版本被覆盖了,然后project1就不能运行了,我该怎么做才能让两个项目都正常运行?
D:\soar\totems-siip-soar-plugins\totems-siip-soar-plugins-pycommon>pip show kafka
Name: kafka
Version: 1.2.0
Summary: Pure Python client for Apache Kafka
Home-page: https://github.com/dpkp/kafka-python
Author: Dana Powers
Author-email: dana.powers@gmail.com
License: Apache License 2.0
Location: c:\users\administrator\appdata\local\programs\python\python39\lib\site-packages
Requires: six
Required-by: totems-pycommon当我安装其他版本时:
D:\soar\totems-siip-soar-plugins\totems-siip-soar-plugins-pycommon>pip install kafka==1.3.0
Looking in indexes: http://192.168.218.125:8081/repository/pypi_group_test/simple
Collecting kafka==1.3.0
Downloading http://192.168.218.125:8081/repository/pypi_group_test/packages/kafka/1.3.0/kafka-1.3.0-py2.py3-none-any.whl (193 kB)
|████████████████████████████████| 193 kB ...
Installing collected packages: kafka
Attempting uninstall: kafka
Found existing installation: kafka 1.2.0
Uninstalling kafka-1.2.0:
Successfully uninstalled kafka-1.2.0
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
totems-pycommon 1.0.0 requires kafka==1.2.0, but you have kafka 1.3.0 which is incompatible.
Successfully installed kafka-1.3.0发布于 2021-10-19 06:47:07
您可以使用python的venv来创建具有独立包的独立环境
要创建环境,可以使用以下命令:
python3 -m venv /some/path/env-name在此之后,您可以使用以下命令激活它
/some/path/env-name/Scripts.bat # on Windows
source /some/path/env-name/bin/activate # on Linux当环境处于活动状态时,您安装的包仅在该环境中可用。通过为您的每个项目设置一个环境,您可以避免您正在讨论的那种冲突。
https://stackoverflow.com/questions/69626003
复制相似问题