【问题标题】:Installing python packages using requirements.txt file使用 requirements.txt 文件安装 python 包
【发布时间】:2023-01-12 19:31:18
【问题描述】:

我正在尝试使用 requirements.txt 文件从 python 安装一些包并执行一些直到我遇到此错误

Collecting numpy
  Using cached numpy-1.24.1-cp311-cp311-win_amd64.whl (14.8 MB)
Collecting nltk
  Using cached nltk-3.8.1-py3-none-any.whl (1.5 MB)
Collecting gensim
  Using cached gensim-4.3.0-cp311-cp311-win_amd64.whl (24.0 MB)
Collecting scikit-learn
  Using cached scikit_learn-1.2.0-cp311-cp311-win_amd64.whl (8.2 MB)
Collecting PyDictionary
  Using cached PyDictionary-2.0.1-py3-none-any.whl (6.1 kB)
Collecting fuzzywuzzy
  Using cached fuzzywuzzy-0.18.0-py2.py3-none-any.whl (18 kB)
Requirement already satisfied: beautifulsoup4 in c:\users\administrator\plagcheker\.plagenv\lib\site-packages (from -r requirements.txt (line 7)) (4.11.1)
Collecting python-Levenshtein
  Using cached python_Levenshtein-0.20.9-py3-none-any.whl (9.4 kB)
Collecting pandas
  Using cached pandas-1.5.2-cp311-cp311-win_amd64.whl (10.3 MB)
Collecting py-stringmatching
  Using cached py_stringmatching-0.4.2.tar.gz (661 kB)
  Preparing metadata (setup.py) ... done
ERROR: Ignored the following versions that require a different python version: 1.21.2 Requires-Python >=3.7,<3.11; 1.21.3 Requires-Python >=3.7,<3.11; 1.21.4 Requires-Python >=3.7,<3.11; 1.21.5 Requires-Python >=3.7,<3.11; 1.21.6 Requires-Python >=3.7,<3.11
ERROR: Could not find a version that satisfies the requirement tkinter (from versions: none)
ERROR: No matching distribution found for tkinter

我的 requirements.txt 有:

 nltk
 gensim
 scikit-learn
 PyDictionary
 fuzzywuzzy
 beautifulsoup4
 python-Levenshtein
 pandas
 py-stringmatching
 tkinter
 python-docx

可能是什么问题?

【问题讨论】:

  • tkinter 在大多数平台上都包含在 Python 本身中。

标签: python pip package


【解决方案1】:

首先 - tkinter 应该已经安装在你的 Python 上,如果你有的话Windows 或 MacOSInfo here

第二 - 对于debian 和 linux- Tkinter 不是通过 pip 分发的;如果它没有预先打包在 Python 中,则必须从其他地方获取它

对于 Python 3:

sudo apt-get install python3-tk 

对于 Python 2.7

sudo apt-get install python-tk

如您所见,名称不等于“tkinter”,因此请将其更改为您的版本
只有当你使用 yum 时它才会工作

yum install tkinter

附言如果出于某种原因您在 MAC 上没有它,您可以使用其他语法的 Debian 和 Linux 命令:

brew install python-tk

如您所见,名称仍然不是“tkinter”。如果您的 .exe 不使用 pip,您可以在“requirements.txt”文件中更改它

【讨论】:

  • 主要问题只是哪种方法是您的可执行文件。使用。你有哪个系统。该错误在 Windows 或 Mac 上没有问题。你已经有了这个,如果它使用 pip - 里面没有这样的包
【解决方案2】:

你应该安装

sudo apt-get install python-tk

这应该可以解决您的问题

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-05-13
    • 1970-01-01
    • 2021-06-24
    • 1970-01-01
    • 1970-01-01
    • 2020-11-07
    • 2020-11-01
    • 1970-01-01
    相关资源
    最近更新 更多