Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

install_ubuntu.sh安装失败,是否应该改成使用虚拟环境?

Đang mở
#257 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
45/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
bash, python
Lĩnh vực
devops, tooling

Hướng nghiên cứu

Bắt đầu với install_ubuntu.sh và luồng touch_env.sh được mô tả trong phần tái hiện, sau đó kiểm tra cách các gói Python được cài đặt trên Ubuntu 24.04. Xác minh lỗi PEP 668 và việc thiết lập môi trường ảo đã được báo cáo. Được xem là hoàn tất khi trình cài đặt được tài liệu hóa chạy xong và scons, pkgs cùng menuconfig hoạt động mà không có lỗi pip trên toàn hệ thống.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

问题复现

在Ubuntu 24.04.2 LTS系统,bash运行安装命令:

jswyll@jswyll:~/code/stm32f407-atk-explorer-v5.2.0$ wget https://gitee.com/RT-Thread-Mirror/env/raw/master/install_ubuntu.sh
chmod 777 install_ubuntu.sh
./install_ubuntu.sh --gitee
rm install_ubuntu.sh
https://gitee.com/RT-Thread-Mirror/env/raw/master/install_ubuntu.sh
正在解析主机 gitee.com (gitee.com)... 180.76.198.225, 180.76.199.13, 180.76.198.77
正在连接 gitee.com (gitee.com)|180.76.198.225|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度: 430 [text/plain]
正在保存至: ‘install_ubuntu.sh’

install_ubuntu.sh.1                                    100%[============================================================================================================================>]     430  --.-KB/s    用时 0s    

(141 MB/s) - 已保存 ‘install_ubuntu.sh’ [430/430])
正在读取软件包列表... 完成
error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
    python3-xyz, where xyz is the package you are trying to
    install.
    
    If you wish to install a non-Debian-packaged Python package,
    create a virtual environment using python3 -m venv path/to/venv.
    Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
    sure you have python3-full installed.
    
    If you wish to install a non-Debian packaged Python application,
    it may be easiest to use pipx install xyz, which will manage a
    virtual environment for you. Make sure you have pipx installed.
    
    See /usr/share/doc/python3.12/README.venv for more information.

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.

https://gitee.com/RT-Thread-Mirror/env/raw/master/touch_env.sh
...

我的尝试

把install_ubuntu.sh脚本改为:

#!/usr/bin/env bash

sudo apt-get update
sudo apt-get -qq install python3 python3-venv gcc git libncurses5-dev -y

url=https://raw.githubusercontent.com/RT-Thread/env/master/touch_env.sh
if [ $1 ] && [ $1 = --gitee ]; then
    url=https://gitee.com/RT-Thread-Mirror/env/raw/master/touch_env.sh
fi

wget $url -O touch_env.sh
chmod 777 touch_env.sh
./touch_env.sh $@
rm touch_env.sh

python3 -m venv ~/.env/.venv
source ~/.env/.venv/bin/activate
pip install scons requests tqdm kconfiglib pyyaml

运行:

./install_ubuntu.sh --gitee
正在读取软件包列表... 完成
https://gitee.com/RT-Thread-Mirror/env/raw/master/touch_env.sh
正在解析主机 gitee.com (gitee.com)... 180.76.198.225, 180.76.198.77, 180.76.199.13
正在连接 gitee.com (gitee.com)|180.76.198.225|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度: 1231 (1.2K) [text/plain]
正在保存至: ‘touch_env.sh’

touch_env.sh                                           100%[============================================================================================================================>]   1.20K  --.-KB/s    用时 0s    

(1.42 GB/s) - 已保存 ‘touch_env.sh’ [1231/1231])

.env directory already exists. Would you like to remove and recreate .env directory? (Y/N) Y
正克隆到 '/home/jswyll/.env/packages/packages'...
remote: Enumerating objects: 2363, done.
remote: Counting objects: 100% (2363/2363), done.
remote: Compressing objects: 100% (1881/1881), done.
remote: Total 2363 (delta 709), reused 1541 (delta 421), pack-reused 0 (from 0)
接收对象中: 100% (2363/2363), 789.96 KiB | 449.00 KiB/s, 完成.
处理 delta 中: 100% (709/709), 完成.
正克隆到 '/home/jswyll/.env/packages/sdk'...
remote: Enumerating objects: 26, done.
remote: Counting objects: 100% (26/26), done.
remote: Compressing objects: 100% (17/17), done.
remote: Total 26 (delta 8), reused 25 (delta 8), pack-reused 0 (from 0)
接收对象中: 100% (26/26), 8.13 KiB | 8.13 MiB/s, 完成.
处理 delta 中: 100% (8/8), 完成.
正克隆到 '/home/jswyll/.env/tools/scripts'...
remote: Enumerating objects: 45, done.
remote: Counting objects: 100% (45/45), done.
remote: Compressing objects: 100% (42/42), done.
remote: Total 45 (delta 7), reused 15 (delta 1), pack-reused 0 (from 0)
接收对象中: 100% (45/45), 2.06 MiB | 655.00 KiB/s, 完成.
处理 delta 中: 100% (7/7), 完成.
Collecting scons
  Using cached scons-4.9.0-py3-none-any.whl.metadata (9.0 kB)
Collecting requests
  Using cached requests-2.32.3-py3-none-any.whl.metadata (4.6 kB)
Collecting tqdm
  Using cached tqdm-4.67.1-py3-none-any.whl.metadata (57 kB)
Collecting kconfiglib
  Using cached kconfiglib-14.1.0-py2.py3-none-any.whl.metadata (39 kB)
Collecting pyyaml
  Using cached PyYAML-6.0.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (2.1 kB)
Collecting charset-normalizer<4,>=2 (from requests)
  Using cached charset_normalizer-3.4.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (35 kB)
Collecting idna<4,>=2.5 (from requests)
  Using cached idna-3.10-py3-none-any.whl.metadata (10 kB)
Collecting urllib3<3,>=1.21.1 (from requests)
  Using cached urllib3-2.3.0-py3-none-any.whl.metadata (6.5 kB)
Collecting certifi>=2017.4.17 (from requests)
  Using cached certifi-2025.1.31-py3-none-any.whl.metadata (2.5 kB)
Using cached scons-4.9.0-py3-none-any.whl (4.1 MB)
Using cached requests-2.32.3-py3-none-any.whl (64 kB)
Using cached tqdm-4.67.1-py3-none-any.whl (78 kB)
Using cached kconfiglib-14.1.0-py2.py3-none-any.whl (145 kB)
Using cached PyYAML-6.0.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (767 kB)
Using cached certifi-2025.1.31-py3-none-any.whl (166 kB)
Using cached charset_normalizer-3.4.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (145 kB)
Using cached idna-3.10-py3-none-any.whl (70 kB)
Using cached urllib3-2.3.0-py3-none-any.whl (128 kB)
Installing collected packages: urllib3, tqdm, scons, pyyaml, kconfiglib, idna, charset-normalizer, certifi, requests
Successfully installed certifi-2025.1.31 charset-normalizer-3.4.1 idna-3.10 kconfiglib-14.1.0 pyyaml-6.0.2 requests-2.32.3 scons-4.9.0 tqdm-4.67.1 urllib3-2.3.0

然后可以正常使用scons、pkgs、menuconfig命令。

Ngôn ngữ chính
Python
Star
78
Fork
64
Merge trung bình
1 ngày 6 giờ
Pull request đã merge (30 ngày)
6

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của RT-Thread/env

Tất cả issue của RT-Thread/env

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.