无法安装或使用PIPREQS创建需求。

发布于 2025-01-24 16:26:30 字数 2854 浏览 1 评论 0 原文

我有一个我想发送给其他人的Python项目。我正在尝试创建一个 unignts.txt 文件,其中包含此脚本所需的依赖项,以便我的合作伙伴可以运行脚本。

我尝试安装 pipreqs 这样的: pip install pipreqs 。 这将输出以下内容:

WARNING: Ignoring invalid distribution -ip (c:\python310\lib\site-packages)
WARNING: Ignoring invalid distribution - (c:\python310\lib\site-packages)
WARNING: Ignoring invalid distribution -ip (c:\python310\lib\site-packages)
WARNING: Ignoring invalid distribution - (c:\python310\lib\site-packages)
Requirement already satisfied: pipreqs in c:\python310\lib\site-packages (0.4.11)
Requirement already satisfied: yarg in c:\python310\lib\site-packages (from pipreqs) (0.1.9)
Requirement already satisfied: docopt in c:\python310\lib\site-packages (from pipreqs) (0.6.2)
Requirement already satisfied: requests in c:\users\nroll97\appdata\roaming\python\python310\site-packages (from yarg->pipreqs) (2.26.0)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in c:\users\nroll97\appdata\roaming\python\python310\site-packages (from requests->yarg->pipreqs) (1.26.8)
Requirement already satisfied: idna<4,>=2.5 in c:\users\nroll97\appdata\roaming\python\python310\site-packages (from requests->yarg->pipreqs) (3.3)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\nroll97\appdata\roaming\python\python310\site-packages (from requests->yarg->pipreqs) (2021.10.8)
Requirement already satisfied: charset-normalizer~=2.0.0 in c:\users\nroll97\appdata\roaming\python\python310\site-packages (from requests->yarg->pipreqs) (2.0.11)
WARNING: Ignoring invalid distribution -ip (c:\python310\lib\site-packages)
WARNING: Ignoring invalid distribution - (c:\python310\lib\site-packages)
WARNING: Ignoring invalid distribution -ip (c:\python310\lib\site-packages)
WARNING: Ignoring invalid distribution - (c:\python310\lib\site-packages)
WARNING: Ignoring invalid distribution -ip (c:\python310\lib\site-packages)
WARNING: Ignoring invalid distribution - (c:\python310\lib\site-packages)
WARNING: Ignoring invalid distribution -ip (c:\python310\lib\site-packages)
WARNING: Ignoring invalid distribution - (c:\python310\lib\site-packages)
WARNING: You are using pip version 21.2.4; however, version 22.0.4 is available.
You should consider upgrading via the 'C:\Python310\python.exe -m pip install --upgrade pip' command.

然后,我尝试通过运行命令:

pipreqs ./my_calc.py

从包含Python脚本的文件夹中创建 unignts.txt 文件,我会收到以下错误:

bash: pipreqs: command not found

为什么我不能使用 pipreqs ?我一直使用 PIP安装其他库。

另外,我在Windows计算机上。是否有一种更简单的方法来创建 unigess.txt 即使手动即使文件?

这些是唯一的进口:

import pandas as pd
import os
import openpyxl
import os.path
import math
from tkinter import filedialog

I have a Python project that I would like to send to someone else. I am trying to create a requirements.txt file containing the required dependencies for this script so that my partner can run the script.

I tried installing pipreqs like this: pip install pipreqs.
This outputs the following:

WARNING: Ignoring invalid distribution -ip (c:\python310\lib\site-packages)
WARNING: Ignoring invalid distribution - (c:\python310\lib\site-packages)
WARNING: Ignoring invalid distribution -ip (c:\python310\lib\site-packages)
WARNING: Ignoring invalid distribution - (c:\python310\lib\site-packages)
Requirement already satisfied: pipreqs in c:\python310\lib\site-packages (0.4.11)
Requirement already satisfied: yarg in c:\python310\lib\site-packages (from pipreqs) (0.1.9)
Requirement already satisfied: docopt in c:\python310\lib\site-packages (from pipreqs) (0.6.2)
Requirement already satisfied: requests in c:\users\nroll97\appdata\roaming\python\python310\site-packages (from yarg->pipreqs) (2.26.0)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in c:\users\nroll97\appdata\roaming\python\python310\site-packages (from requests->yarg->pipreqs) (1.26.8)
Requirement already satisfied: idna<4,>=2.5 in c:\users\nroll97\appdata\roaming\python\python310\site-packages (from requests->yarg->pipreqs) (3.3)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\nroll97\appdata\roaming\python\python310\site-packages (from requests->yarg->pipreqs) (2021.10.8)
Requirement already satisfied: charset-normalizer~=2.0.0 in c:\users\nroll97\appdata\roaming\python\python310\site-packages (from requests->yarg->pipreqs) (2.0.11)
WARNING: Ignoring invalid distribution -ip (c:\python310\lib\site-packages)
WARNING: Ignoring invalid distribution - (c:\python310\lib\site-packages)
WARNING: Ignoring invalid distribution -ip (c:\python310\lib\site-packages)
WARNING: Ignoring invalid distribution - (c:\python310\lib\site-packages)
WARNING: Ignoring invalid distribution -ip (c:\python310\lib\site-packages)
WARNING: Ignoring invalid distribution - (c:\python310\lib\site-packages)
WARNING: Ignoring invalid distribution -ip (c:\python310\lib\site-packages)
WARNING: Ignoring invalid distribution - (c:\python310\lib\site-packages)
WARNING: You are using pip version 21.2.4; however, version 22.0.4 is available.
You should consider upgrading via the 'C:\Python310\python.exe -m pip install --upgrade pip' command.

I then tried to create the requirements.txt file by running the command:

pipreqs ./my_calc.py

from the folder that contains the Python script and I get the following error:

bash: pipreqs: command not found

Why can't I use pipreqs? I use pip install all the time for other libraries.

Also, I am on a Windows computer. Is there an easier way to create the requirements.txt file even if its manually?

These are the only imports:

import pandas as pd
import os
import openpyxl
import os.path
import math
from tkinter import filedialog

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

╭ゆ眷念 2025-01-31 16:26:30

我仍然无法使 pipreqs 正常工作,所以我刚刚通过首先了解了使用哪些版本的Python模块来手动制作 unigess.txt 文件。

我发现这样的是这样:

import pandas as pd
import os
import openpyxl
import os.path
import math
from tkinter import filedialog
# VERSIONS OF LIBRARIES AS OF DEVELOPMENT - 04/28/2022
print("Version of pd: " + str(pd.__version__)) # 1.4.2
print("Version of openpyxl: " + str(openpyxl.__version__)) # 3.0.9
print("Version of tkinter: " + str(tkinter.TkVersion)) # 8.6

然后从这样的值中创建 support.txt (但仅用于标准Python库中尚未包含的导入):

pandas==1.4.2
openpyxl==3.0.9

I still wasn't able to get the pipreqs to work so I just made the requirements.txt file manually by first finding out which versions of the Python modules are being used.

I found that out like this:

import pandas as pd
import os
import openpyxl
import os.path
import math
from tkinter import filedialog
# VERSIONS OF LIBRARIES AS OF DEVELOPMENT - 04/28/2022
print("Version of pd: " + str(pd.__version__)) # 1.4.2
print("Version of openpyxl: " + str(openpyxl.__version__)) # 3.0.9
print("Version of tkinter: " + str(tkinter.TkVersion)) # 8.6

And then created the requirements.txt from those values like this (but only for the imports that are not already included in the standard Python library):

pandas==1.4.2
openpyxl==3.0.9
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文