AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / ubuntu / 问题 / 1384614
Accepted
Carol.Kar
Carol.Kar
Asked: 2022-01-01 08:03:03 +0800 CST2022-01-01 08:03:03 +0800 CST 2022-01-01 08:03:03 +0800 CST

由于未满足依赖关系,无法创建 venv

  • 772

我在 VirtualBox 上运行Ubuntu 18.04.5 LTS。我正在跑步Python 3.6.9。

尝试创建虚拟环境时,sudo python3 -m venv env我得到:

admin@admin-VirtualBox:~/Desktop/project$ sudo python3 -m venv .venv
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/admin/Desktop/project/.venv/bin/python3', '-Im', 'ensurepip', '--upgrade', '--default-pip']

admin@admin-VirtualBox:~/Desktop/project$ python3 --version
Python 3.6.9
admin@admin-VirtualBox:~/Desktop/project$ sudo apt-get install python3.6-venv
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 python3.6-venv : Depends: python3.6 (= 3.6.5-3) but 3.6.9-1~18.04ubuntu1.1 is to be installed
E: Unable to correct problems, you have held broken packages.
admin@admin-VirtualBox:~/Desktop/project$ 

我研究并发现python3已经venv预装了。我相信有一些破碎的依赖关系。

我试过了:

admin@admin-VirtualBox:~/Desktop/project$ sudo apt-cache policy python3.6-venv python3.6 python3
python3.6-venv:
  Installed: (none)
  Candidate: 3.6.5-3
  Version table:
     3.6.5-3 500
        500 http://at.archive.ubuntu.com/ubuntu bionic/universe amd64 Packages
python3.6:
  Installed: 3.6.9-1~18.04ubuntu1.1
  Candidate: 3.6.9-1~18.04ubuntu1.1
  Version table:
 *** 3.6.9-1~18.04ubuntu1.1 100
        100 /var/lib/dpkg/status
     3.6.5-3 500
        500 http://at.archive.ubuntu.com/ubuntu bionic/main amd64 Packages
python3:
  Installed: 3.6.7-1~18.04
  Candidate: 3.6.7-1~18.04
  Version table:
 *** 3.6.7-1~18.04 100
        100 /var/lib/dpkg/status
     3.6.5-3 500
        500 http://at.archive.ubuntu.com/ubuntu bionic/main amd64 Packages

任何建议如何解决这个问题?问题是什么?

感谢您的回复!

18.04
  • 1 1 个回答
  • 273 Views

1 个回答

  • Voted
  1. Best Answer
    user.dz
    2022-01-01T08:28:53+08:002022-01-01T08:28:53+08:00
    1. 跑software-properties-gtk

      第一个选项卡:启用main, universe, 第二个选项卡:启用security,updates

    2. 退出或运行时更新列表

      sudo apt update

    3. 安装虚拟环境模块(我希望它安装在香草图像上)

      sudo apt install python3.6-venv

    4. 在不使用的情况下创建虚拟环境sudo

      python3 -m venv .venv

    顺便说一句,最好确认哪个是python3使用的链接版本

    ls -l $(which python3)
    
    • 2

相关问题

  • Ubuntu 16.10 及更高版本中的 Nautilus 功能“创建链接”发生了什么变化?

  • 使用标准接口(使用 mimetype)以编程方式修改文件关联

  • 我可以从 Evince 拖放到 Thunderbird 吗?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何运行 .sh 脚本?

    • 16 个回答
  • Marko Smith

    如何安装 .tar.gz(或 .tar.bz2)文件?

    • 14 个回答
  • Marko Smith

    如何列出所有已安装的软件包

    • 24 个回答
  • Marko Smith

    无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗?

    • 25 个回答
  • Martin Hope
    Flimm 如何在没有 sudo 的情况下使用 docker? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    Ivan 如何列出所有已安装的软件包 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    La Ode Adam Saputra 无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗? 2010-11-30 18:12:48 +0800 CST
  • Martin Hope
    David Barry 如何从命令行确定目录(文件夹)的总大小? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher “以下软件包已被保留:”为什么以及如何解决? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford 如何删除 PPA? 2010-07-30 01:09:42 +0800 CST

热门标签

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve