如何在Ubuntu上解决前命中率误差22.04

发布于 2025-01-26 22:35:19 字数 2185 浏览 3 评论 0原文

我正在使用Ubuntu 22.04,而Python版本为3.10.4。 我已经在cookie-cutter上安装了一个Django项目。现在,当我想提交更改时,我有一个错误。

这是错误:

(blog) ➜  blog git:(main) ✗ pre-commit run
[INFO] Installing environment for https://github.com/pre-commit/pre-commit-hooks.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
An unexpected error has occurred: AssertionError: BUG: expected environment for python to be healthy() immediately after install, please open an issue describing your environment
Check the log at /home/mahdi/.cache/pre-commit/pre-commit.log

pre-commit.log的内容:

### version information

```
pre-commit version: 2.18.1
git --version: git version 2.34.1
sys.version:
    3.10.4 (main, Apr  2 2022, 09:04:19) [GCC 11.2.0]
sys.executable: /home/mahdi/.local/share/virtualenvs/blog-qatotdDy/bin/python
os.name: posix
sys.platform: linux
```

### error information

```
An unexpected error has occurred: AssertionError: BUG: expected environment for python to be healthy() immediately after install, please open an issue describing your environment
```

```
Traceback (most recent call last):
  File "/home/mahdi/.local/share/virtualenvs/blog-qatotdDy/lib/python3.10/site-packages/pre_commit/error_handler.py", line 73, in error_handler
    yield
  File "/home/mahdi/.local/share/virtualenvs/blog-qatotdDy/lib/python3.10/site-packages/pre_commit/main.py", line 371, in main
    return run(args.config, store, args)
  File "/home/mahdi/.local/share/virtualenvs/blog-qatotdDy/lib/python3.10/site-packages/pre_commit/commands/run.py", line 414, in run
    install_hook_envs(to_install, store)
  File "/home/mahdi/.local/share/virtualenvs/blog-qatotdDy/lib/python3.10/site-packages/pre_commit/repository.py", line 221, in install_hook_envs
    _hook_install(hook)
  File "/home/mahdi/.local/share/virtualenvs/blog-qatotdDy/lib/python3.10/site-packages/pre_commit/repository.py", line 83, in _hook_install
    raise AssertionError(
AssertionError: BUG: expected environment for python to be healthy() immediately after install, please open an issue describing your environment
```

我在Google上进行了搜索,但找不到任何解决方案。

I am using ubuntu 22.04 and the python version is 3.10.4.
I have installed a Django project with the cookie-cutter. and now I have got an error when I want to commit my changes.

here is the error:

(blog) ➜  blog git:(main) ✗ pre-commit run
[INFO] Installing environment for https://github.com/pre-commit/pre-commit-hooks.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
An unexpected error has occurred: AssertionError: BUG: expected environment for python to be healthy() immediately after install, please open an issue describing your environment
Check the log at /home/mahdi/.cache/pre-commit/pre-commit.log

Content of pre-commit.log:

### version information

```
pre-commit version: 2.18.1
git --version: git version 2.34.1
sys.version:
    3.10.4 (main, Apr  2 2022, 09:04:19) [GCC 11.2.0]
sys.executable: /home/mahdi/.local/share/virtualenvs/blog-qatotdDy/bin/python
os.name: posix
sys.platform: linux
```

### error information

```
An unexpected error has occurred: AssertionError: BUG: expected environment for python to be healthy() immediately after install, please open an issue describing your environment
```

```
Traceback (most recent call last):
  File "/home/mahdi/.local/share/virtualenvs/blog-qatotdDy/lib/python3.10/site-packages/pre_commit/error_handler.py", line 73, in error_handler
    yield
  File "/home/mahdi/.local/share/virtualenvs/blog-qatotdDy/lib/python3.10/site-packages/pre_commit/main.py", line 371, in main
    return run(args.config, store, args)
  File "/home/mahdi/.local/share/virtualenvs/blog-qatotdDy/lib/python3.10/site-packages/pre_commit/commands/run.py", line 414, in run
    install_hook_envs(to_install, store)
  File "/home/mahdi/.local/share/virtualenvs/blog-qatotdDy/lib/python3.10/site-packages/pre_commit/repository.py", line 221, in install_hook_envs
    _hook_install(hook)
  File "/home/mahdi/.local/share/virtualenvs/blog-qatotdDy/lib/python3.10/site-packages/pre_commit/repository.py", line 83, in _hook_install
    raise AssertionError(
AssertionError: BUG: expected environment for python to be healthy() immediately after install, please open an issue describing your environment
```

I have search on google, but couldn't find any solution.

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

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

发布评论

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

评论(3

酒绊 2025-02-02 22:35:19

我遇到了同样的问题,但是在Mac上

An unexpected error has occurred: AssertionError: BUG: expected environment for python to be healthy immediately after install, please open an issue describing your environment

more info:

virtualenv python version did not match created version:
- actual version: <<error retrieving version from /Users/federico/.cache/pre-commit/repo9xb3zg69/py_env-python3.11/bin/python>>
- expected version: 3.11.2.final.0

Check the log at /Users/federico/.cache/pre-commit/pre-commit.log

>我做到了

virtualenv --reset-app-data venv

,这解决了我的问题

I had the same problem but on Mac

An unexpected error has occurred: AssertionError: BUG: expected environment for python to be healthy immediately after install, please open an issue describing your environment

more info:

virtualenv python version did not match created version:
- actual version: <<error retrieving version from /Users/federico/.cache/pre-commit/repo9xb3zg69/py_env-python3.11/bin/python>>
- expected version: 3.11.2.final.0

Check the log at /Users/federico/.cache/pre-commit/pre-commit.log

Following this thread I did

virtualenv --reset-app-data venv

And that resolved my problem

沦落红尘 2025-02-02 22:35:19

这是ubuntu上的Python 3.10的一个已知问题“ rel =“ nofollow noreferrer”>在这里

附带说明,我还看到您打开了一张新票,而不是在预先承担的问题中搜索问题跟踪器,此问题是通过搜索“搜索”中的“

This is a known issue with python 3.10 on Ubuntu 22.04, you can use the python 3.10 from deadsnakes as directed here

Side note, I also see that you opened a new ticket rather than searching the issue tracker within pre-commit, this issue was specifically called out in a number of tickets by searching "healthy()". It would be preferable in the future to put some better search terms in place prior to logging an issue in GitHub to reduce the noise for open source maintainers.

夜光 2025-02-02 22:35:19

我使用以下内容解决了它(您可以将其添加到.bashrc):

export SETUPTOOLS_USE_DISTUTILS=stdlib

感谢此所以回答< /a>。

I solved it with the following (you can add it to your .bashrc):

export SETUPTOOLS_USE_DISTUTILS=stdlib

thanks to this SO answer.

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