Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error: externally-managed-environment #8

Open
HuaYuXiao opened this issue Mar 30, 2024 · 2 comments
Open

error: externally-managed-environment #8

HuaYuXiao opened this issue Mar 30, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@HuaYuXiao
Copy link
Owner

hyx020222@raspberrypi:~/NCSLab $ pip install http.server
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.
    
    For more information visit http://rptl.io/venv

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.
@HuaYuXiao HuaYuXiao added the bug Something isn't working label Mar 30, 2024
@HuaYuXiao
Copy link
Owner Author

看起来你遇到了一个错误,因为你正在尝试在树莓派上使用系统管理的Python环境进行安装。你可以尝试以下步骤:

  1. 使用apt安装Python模块: 由于http.server模块是Python标准库的一部分,通常情况下不需要额外安装。你可以尝试使用以下命令来安装Python 3的http.server模块:
sudo apt update
sudo apt install python3
  1. 创建虚拟环境: 如果你想要在项目中使用特定的Python包,而不影响系统级别的Python环境,你可以创建一个虚拟环境并在其中安装所需的包。
python3 -m venv myenv
source myenv/bin/activate
pip install http.server

这将在名为myenv的目录中创建一个虚拟环境,并在其中安装http.server模块。

尝试以上步骤后,你应该能够在树莓派上使用http.server模块了。

@HuaYuXiao HuaYuXiao pinned this issue Mar 30, 2024
@HuaYuXiao
Copy link
Owner Author

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant