apt-get install python3-venv 不起作用
我正在使用 chromebook,使用 Debian。我需要运行终端命令 python -m venv env
,但是当我使用它时,我收到错误,
The virtual environment was not created successfully because ensurepip is not
available. On Debian/Ubuntu systems, you need to install the python3-venv
package using the following command.
apt-get install python3-venv
You may need to use sudo with that command. After installing the python3-venv
package, recreate your virtual environment.
Failing command: ['/home/jacob/env/bin/python3', '-Im', 'ensurepip', '--upgrade', '--default-pip']
所以我运行 apt-get install python3-venv
但得到错误
E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?
任何人都可以帮忙解决这个问题吗?
I am using a chromebook, using Debian. I need to run the terminal command python -m venv env
, but when I use it, I get the errors
The virtual environment was not created successfully because ensurepip is not
available. On Debian/Ubuntu systems, you need to install the python3-venv
package using the following command.
apt-get install python3-venv
You may need to use sudo with that command. After installing the python3-venv
package, recreate your virtual environment.
Failing command: ['/home/jacob/env/bin/python3', '-Im', 'ensurepip', '--upgrade', '--default-pip']
so I run apt-get install python3-venv
but get the errors
E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?
Can anyone help with this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
这是:
It is:
正如它所说,
执行 sudo apt-get install python3-venv 以 root 身份运行 apt-get 命令。
之后,您不需要以 root 身份运行其他命令(或使用 sudo)除非您的 Python 依赖项有一些系统级库依赖项。 (您不需要
apt-get install
任何其他python3
软件包。)As it says,
Do
sudo apt-get install python3-venv
to run theapt-get
command as root.After that, you should not need to run other commands as root (or using
sudo
) unless there are some system-level library dependencies for your Python dependencies. (You shouldn't need toapt-get install
any otherpython3
packages.)要使用 apt 安装任何软件包,您必须是 root 用户才能安装和删除任何软件包。安装完成后,如果您允许任何用户访问该软件包,则任何用户都可以使用该软件包(默认情况下,每当 root 安装软件包时,其他用户都会获得运行它的权限)
因此,要解决此问题,请尝试:
或
通过使用
sudo su
你就成为root用户了。因此,当您是 root 用户时,无需在命令前添加 sudo 。To install any package using
apt
you must be a root user to install and remove any package. Once the installation is done then any user can use that package if you have allowed them to access it (By default whenever root install a package other users gets permission to run it)So to solve this problem try:
or
By using the
sudo su
you become the root user. So when you are a root user you don't have to append thesudo
before your command.这看起来像是一个权限问题。
尝试:
It looks like a permission issue.
Try:
您需要安装特定版本。
我使用了这个并解决了 python3.10 的问题:
这对我有用。
You need to install a specific version.
I used this and solved my problem for python3.10:
This worked for me.
就这样做:
然后再试一次
Just do:
and try again
如果有人遇到这个问题,只需运行:
在本例中 python3.10-venv 代表 python3.10
If someone is facing with this issue, just run:
Where python3.10-venv stands for python3.10 in this example