С oumand tox -r do deploy venv python在项目中

发布于 2025-01-24 20:24:33 字数 712 浏览 4 评论 0原文

我有一些项目,可以通过Windows正确的工作在本地PC上。 当我通过服务器上的GitLab复制此项目时,我看不到一些文件夹。 因此,TOX -R命令不在项目中部署Venv Python。我该如何解决? tox.ini:

[tox]
skipsdist = True
envlist = testenv

[testenv]
basepython = python3.7
alwayscopy=true
envdir = venv
setenv =
    PYTHONPATH={toxinidir}/framework{:}{toxinidir}/pytest_plugins{:}venv/Lib/site-packages/
    PYTHONIOENCODING = UTF-8

deps =
    attrdict
    Faker==5.0.1
    luhnpy==1.0.0
    mimesis==4.1.2
    pytest==4.4.0
    requests
    selenium==3.141.0
    openpyxl

commands =
    -python`

文件夹结构:

I have some project, that on my local pc by windows correct work.
When I copy this project through gitlab on server, I don't see some folders.
So, tox -r command doesn't deploy venv python in project. How can I fix this?
Tox.ini :

[tox]
skipsdist = True
envlist = testenv

[testenv]
basepython = python3.7
alwayscopy=true
envdir = venv
setenv =
    PYTHONPATH={toxinidir}/framework{:}{toxinidir}/pytest_plugins{:}venv/Lib/site-packages/
    PYTHONIOENCODING = UTF-8

deps =
    attrdict
    Faker==5.0.1
    luhnpy==1.0.0
    mimesis==4.1.2
    pytest==4.4.0
    requests
    selenium==3.141.0
    openpyxl

commands =
    -python`

Folder structure:
enter image description here

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

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

发布评论

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

评论(2

玻璃人 2025-01-31 20:24:33

Tox利用Python(3)-venv创建VENV文件夹。

VENV文件夹在Windows和Linux上看起来不同。如Windows中的屏幕截图所示,您的文件夹脚本,而在Linux中,您有文件夹bin
tmp文件夹是特定于Windows的,在Linux中创建时不存在。

因此,这是预期的行为,我们不知道您要实现什么。


这就是您在Windows中激活VENV的方式:

.\venv\Scripts\activate

激活Linux中的VENV:第一行。

source venv/bin/activate
source /path/to/venv/bin/activate

这就是您在使用venv文件夹中工作目录时

Tox utilizes python(3)-venv to create the venv folder.

The venv folder looks different on Windows and Linux. As shown in your screenshot in Windows you have folder Script whereas in Linux you have the folder bin.
The tmp folder is Windows specific and does not exist when creating in Linux.

So this is intended behavior and we don't know what you are trying to achieve.


This is how you activate the venv in Windows:

.\venv\Scripts\activate

This is how you activate the venv in Linux:

source venv/bin/activate
source /path/to/venv/bin/activate

First line when you are in working directory with the venv folder.

农村范ル 2025-01-31 20:24:33

我发现问题。我需要添加yml文件命令源/home/gitlab-runner/xxx/venv/bin/activate

I find problem. I needed to add in yml file command source /home/gitlab-runner/xxx/venv/bin/activate

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