【发布时间】:2021-02-14 04:47:51
【问题描述】:
您好,我在使用 Python 中的 pipreqs 库时遇到问题。它不会生成正确的requirements.txt 文件。我正在使用 Python 虚拟环境,我安装的唯一软件包是 pipreqs 和 selenium with
pip install pipreqs
pip install selenium
项目结构:
MyProject
|- test.py
而test.py只有一行:
from selenium import webdriver
我做的第一件事
pipreqs ./
我收到了错误UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 3474: character maps to <undefined>
我设法通过使用解决了
pipreqs ./ --encoding=utf-8
但是现在生成的requirements.txt 不符合我的预期。在我看来,它应该等于:
selenium==1.341.0
但它等于:
brotli==1.0.9
cryptography==3.2.1
ipaddr==2.2.0
lxml==4.6.1
mock==4.0.2
ordereddict==1.1
protobuf==3.13.0
pyOpenSSL==19.1.0
simplejson==3.17.2
现在,当我尝试克隆此代码并执行 pip install -r requirements.txt 时,它不会安装 selenium 并且代码不会运行。
这里发生了什么?
【问题讨论】:
标签: python package requirements.txt