小编Str*_*420的帖子

已安装 Poetry 但“poetry:未找到命令”

最近我在诗歌方面遇到了一百万零一个问题。

我昨天已经完全安装并工作了,但是重新启动我的机器后,我又遇到了问题;(

即使在重新启动后,是否有办法在我的终端中始终识别诗歌?


系统规格:

  • Windows 10,
  • Visual Studio 代码,
  • Bash - WSL Ubuntu CLI,
  • Python 3.8。

终端:

me@PF2DCSXD:/mnt/c/Users/me/Documents/GitHub/workers-python/workers/data_simulator/src$ poetry run python3 cli.py
poetry: command not found
me@PF2DCSXD:/mnt/c/Users/me/Documents/GitHub/workers-python/workers/data_simulator/src$ curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python3
Retrieving Poetry metadata

This installer is deprecated. Poetry versions installed using this script will not be able to use 'self update' command to upgrade to 1.2.0a1 or later.
Latest version already installed.
me@PF2DCSXD:/mnt/c/Users/me/Documents/GitHub/workers-python/workers/data_simulator/src$ poetry run python3 cli.py
poetry: command not found
me@PF2DCSXD:/mnt/c/Users/me/Documents/GitHub/workers-python/workers/data_simulator/src$ 
Run Code Online (Sandbox Code Playgroud)

如果我可以在帖子中添加其他内容以帮助进一步澄清,请告诉我。

python windows python-poetry

64
推荐指数
7
解决办法
16万
查看次数

诗歌| AttributeError“链接”对象没有属性“名称”

我想从poetry.lock文件安装包;使用poetry install

\n

然而,大多数包都会抛出完全相同的错误,这表明存在共同的基本问题。

\n

是什么原因造成的?标准修复是什么?

\n
\n

规格:

\n
    \n
  • Windows 10,
  • \n
  • Visual Studio 代码,
  • \n
  • Python 3.8.10 和诗歌 1.1.11,
  • \n
  • Ubuntu 狂欢。
  • \n
\n

终端:

\n
    \n
  • rm poetry.lock
  • \n
  • poetry update
  • \n
  • poetry install
  • \n
\n
me@PF2DCSXD:/mnt/c/Users/user/Documents/GitHub/workers-python/workers/composite_key$ poetry update\nUpdating dependencies\nResolving dependencies... (217.2s)\n\nWriting lock file\n\nPackage operations: 55 installs, 8 updates, 0 removals\n\n  \xe2\x80\xa2 Updating pyparsing (3.0.4 -> 2.4.7)\n  \xe2\x80\xa2 Updating pyyaml (5.4.1 -> 6.0)\n  \xe2\x80\xa2 Installing arrow (1.2.1)\n  \xe2\x80\xa2 Installing chardet (4.0.0)\n  \xe2\x80\xa2 …
Run Code Online (Sandbox Code Playgroud)

python-poetry

9
推荐指数
2
解决办法
9905
查看次数

Poetry 未使用推荐的安装程序安装。无法自动更新

如何升级到最新版本?

\n

规格:

\n
    \n
  • Windows 10,
  • \n
  • Visual Studio 代码,
  • \n
  • Ubuntu 狂欢。
  • \n
\n
\n

当前版本:

\n
me@PF2DCSXD:/mnt/c/Users/user/Documents/GitHub/workers-python/workers/composite_key/compositekey/tests$ python3 --version\nPython 3.8.10\n
Run Code Online (Sandbox Code Playgroud)\n

尝试更新 | poetry self update:

\n
me@PF2DCSXD:/mnt/c/Users/user/Documents/GitHub/workers-python/workers/composite_key/compositekey/tests$ poetry self update\n\n  RuntimeError\n\n  Poetry was not installed with the recommended installer. Cannot update automatically.\n\n  at ~/.local/lib/python3.8/site-packages/poetry/console/commands/self/update.py:389 in _check_recommended_installation\n      385\xe2\x94\x82         current = Path(__file__)\n      386\xe2\x94\x82         try:\n      387\xe2\x94\x82             current.relative_to(self.home)\n      388\xe2\x94\x82         except ValueError:\n    \xe2\x86\x92 389\xe2\x94\x82             raise RuntimeError(\n      390\xe2\x94\x82                 "Poetry was not installed with the recommended installer. "\n      391\xe2\x94\x82                 "Cannot update automatically."\n …
Run Code Online (Sandbox Code Playgroud)

python bash python-3.x python-poetry

8
推荐指数
1
解决办法
1万
查看次数

随机排列数据框中的列

我想无序地打乱列;完全伪随机,一行代码。

前:

  A B
0 1 2
1 1 2
Run Code Online (Sandbox Code Playgroud)

后:

  B A
0 2 1
1 2 1
Run Code Online (Sandbox Code Playgroud)

到目前为止我的尝试:

df = df.reindex(columns=columns)

df.sample(frac=1, axis=1)

df.apply(np.random.shuffle, axis=1)
Run Code Online (Sandbox Code Playgroud)

python numpy dataframe pandas

7
推荐指数
2
解决办法
2721
查看次数

Azure DevOps Pipeline 上没有日志记录

更新:

是否可以添加或更改在 Azure DevOps 上执行管道的命令?


在Visual Studio Code上本地运行我的程序,我确实得到了输出。

但是,在Azure DevOps上运行我的GitHub原始分支不会产生任何输出。

我遵循了 Stack Overflow 的答案,该答案引用了GitHub 问题的解决方案

我已经实现了以下内容,但 Azure 的原始日志在我的 Python 上返回空白logging

test_logging.py

import logging

filename = "my.log"

global logger
logger = logging.getLogger()
logger.setLevel(logging.INFO)
formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")
open(filename, "w").close()  # empty logs
fileHandler = logging.FileHandler(filename)
fileHandler.setFormatter(formatter)
fileHandler.setLevel(logging.INFO)
logger.addHandler(fileHandler)

logger.error('TEST')

# fetch logs
with open(filename, "r") as fileHandler:
    logs = [log.rstrip() for log in …
Run Code Online (Sandbox Code Playgroud)

python logging azure azure-devops azure-pipelines

7
推荐指数
1
解决办法
2725
查看次数

诗跑worker.py | FileNotFound [Errno 2] 没有这样的文件或目录:b'/snap/bin/worker.py'

我在与 file 相同的工作目录中执行以下命令worker.py

\n
poetry run worker.py\n
Run Code Online (Sandbox Code Playgroud)\n

终端:

\n
poetry run worker.py\n
Run Code Online (Sandbox Code Playgroud)\n

显然,我们看到该文件就在那里(右下角)。

\n
\n

问题

\n
    \n
  • 为什么会出现这个问题呢?
  • \n
  • 未来您将如何解决这个问题?
  • \n
\n

如果我还需要在帖子中添加其他内容,请告诉我

\n

python bash python-poetry filenotfounderror

5
推荐指数
1
解决办法
8005
查看次数