告诉我,如果我正在尝试做的事情没有意义.
我想创建一个虚拟环境,其中包括MySQLDb 1.2.3.该库作为gzipped tarball(.tgz)文件分发.我想在requirements/apps.txt中的需求文件中安装所有内容 - 包括我本地文件系统上的tarball - 这是基于我在http://thraxil.org/users/anders/posts/2009/06中看到的设置/ 12/Django-Deployment-with-virtualenv-and-pip /):
pip.py install -E ve --enable-site-packages --requirement requirements/apps.txt
Run Code Online (Sandbox Code Playgroud)
我找不到关于本地文件的pip要求文件格式的任何文档.
apps.txt
如果目录requirements/
包含文件,需要file()需要包含MySQL-python-1.2.3.tgz
什么?
我在Github上创建了一个Python模块,它使用Nose进行单元测试,使用Sphinx生成文档.我有两个问题:
我应该在我的模块的setup.py(install_requires)依赖项中包含Sphinx和/或Nose,因为它们不是基本模块功能所必需的,只有你想自己构建文档/运行测试?
我是否应该在Github上的模块的requirements.txt中包含Sphinx和/或Nose,原因相同但是从Github下载我的项目的用户可能更有可能构建docs/run测试?
这是我的第一个Python模块,因此我们将非常感谢您提供一些最佳实践/标准建议.
我想创建一个python分发包,并且需要检查我自己的包所需的所有包。
对于requirements.txt,它包括它需要的所有包。但是,我想找到一种方法来检查我需要的所有包,并且对于某些包,它们也是我项目中其他包的一些要求。
有什么方法可以检查我需要哪些包,并为我自己的项目维护最少的包?
该PIP requirements.txt文件称,演员可以用线等安装
MyPackage==3.0 [PDF]
Run Code Online (Sandbox Code Playgroud)
所以在我的requirements.txt文件中,我有一行内容如下:
requests==2.9.1 [security]
Run Code Online (Sandbox Code Playgroud)
但是,当我运行命令时,不是为请求模块安装安全附加功能:
pip install -r requirements.txt
Run Code Online (Sandbox Code Playgroud)
我收到一条错误消息,提示我的文件格式不正确:
Invalid requirement: 'requests==2.9.1 [security]'
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 77, in __init__
req = pkg_resources.Requirement.parse(req)
File "/Library/Python/2.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3036, in parse
req, = parse_requirements(s)
File "/Library/Python/2.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2980, in parse_requirements
"version spec")
File "/Library/Python/2.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2956, in scan_list
raise RequirementParseError(msg, line, "at", line[p:])
RequirementParseError: Expected ',' or end-of-list in requests==2.9.1 [security] at [security]
Run Code Online (Sandbox Code Playgroud)
有谁知道我可能做错了什么?
来自:https : //github.com/brandon-rhodes/luca/blob/master/requirements.txt
ansi2html
pytest
sphinx
tox
-e .
Run Code Online (Sandbox Code Playgroud)
最后一行是-e .
做什么的?
我正在编写一个 Python 包,我想在 pypi 和 conda 上发布。为了避免错误,我想将需求存储在一个文件中;至少在可预见的未来,它们是一样的。
从meta.yaml 到setup.py 很容易(例如通过pyyaml),但是反过来呢?如何将需求注入到meta.yaml中?
有没有类似的东西:
{% set data = load_setup_py_data() %}
...
requirements:
run:
{{ data.get('install_requires') }}
Run Code Online (Sandbox Code Playgroud)
这种情况的最佳实践是什么?
您好,我在使用 Python 库时遇到问题pipreqs
。它不会生成正确的requirements.txt
文件。我正在使用 Python 虚拟环境,我安装的唯一软件包是pipreqs
和selenium
pip install pipreqs
pip install selenium
Run Code Online (Sandbox Code Playgroud)
项目结构:
MyProject
|- test.py
Run Code Online (Sandbox Code Playgroud)
并且test.py
只有一行:
pip install pipreqs
pip install selenium
Run Code Online (Sandbox Code Playgroud)
首先当我这样做的时候
pipreqs ./
Run Code Online (Sandbox Code Playgroud)
我遇到了错误UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 3474: character maps to <undefined>
,我设法通过使用解决了
pipreqs ./ --encoding=utf-8
Run Code Online (Sandbox Code Playgroud)
但现在requirements.txt
生成的结果与我的期望不符。在我看来,它应该等于:
selenium==1.341.0
Run Code Online (Sandbox Code Playgroud)
但它等于:
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
Run Code Online (Sandbox Code Playgroud)
现在,当我尝试克隆此代码并执行它时,pip install -r requirements.txt
它不会安装selenium
,并且代码不会运行。
这里发生了什么事?
我有一个包含所有已安装软件包的需求文件。在项目的大规模重构过程之后,不再需要列出的一些包。问题是我不确定是哪一个。有没有办法确定requirements.txt文件中列出的哪些包在代码中实际使用?
我有一个 Python3 Poetry 项目,其中有一个pyproject.toml
指定依赖项的文件:
[tool.poetry.dependencies]
python = "^3.10"
nltk = "^3.7"
numpy = "^1.23.4"
scipy = "^1.9.3"
scikit-learn = "^1.1.3"
joblib = "^1.2.0"
[tool.poetry.dev-dependencies]
pytest = "^5.2"
Run Code Online (Sandbox Code Playgroud)
我requirements.txt
使用命令将这些依赖项导出到文件中poetry export --without-hashes -f requirements.txt --output requirements.txt
,生成以下文件requirements.txt
:
click==8.1.3 ; python_version >= "3.10" and python_version < "4.0"
colorama==0.4.6 ; python_version >= "3.10" and python_version < "4.0" and platform_system == "Windows"
joblib==1.2.0 ; python_version >= "3.10" and python_version < "4.0"
nltk==3.8.1 ; python_version >= "3.10" and python_version …
Run Code Online (Sandbox Code Playgroud) 我想在我的requirements.txt
for中设置依赖项tensorflow~=2.5.0
。截至撰写本文时,tensorflow==2.5.0
尚未发布。可用的最新版本是候选版本tensorflow==2.5.0rc3
。我如何简洁地告诉pip
“安装最新的tensorflow
2.5.x 版本,包括候选版本”?
到目前为止我尝试过的:
tensorflow~=2.5.0
ERROR: Could not find a version that satisfies the requirement tensorflow~=2.5.0 (from versions: 2.5.0rc0, 2.5.0rc1, 2.5.0rc2, 2.5.0rc3)
ERROR: No matching distribution found for tensorflow~=2.5.0
Run Code Online (Sandbox Code Playgroud)
tensorflow>2.4.1
ERROR: Could not find a version that satisfies the requirement tensorflow>2.4.1 (from versions: 1.13.0rc1, 1.13.0rc2, 1.13.1, 1.13.2, 1.14.0rc0, 1.14.0rc1, 1.14.0, 1.15.0rc0, 1.15.0rc1, 1.15.0rc2, 1.15.0rc3, 1.15.0, 1.15.2, 1.15.3, 1.15.4, 1.15.5, 2.0.0a0, 2.0.0b0, 2.0.0b1, 2.0.0rc0, 2.0.0rc1, 2.0.0rc2, 2.0.0, 2.0.1, 2.0.2, 2.0.3, …
Run Code Online (Sandbox Code Playgroud) python ×10
requirements.txt ×10
pip ×7
anaconda ×1
dependencies ×1
package ×1
pypi ×1
python-3.x ×1
setup.py ×1
standards ×1
virtualenv ×1