python-3.7 - 安装 Python 3.7 时出错 - E:子进程 /usr/bin/dpkg 返回错误代码 (1)
问题描述
我试图使用“sudo apt-get install python3.7”在我的 Ubuntu 虚拟机中安装 python 3.7。但是,我得到了以下输出: -
Building dependency tree
Reading state information... Done
python3.7 is already the newest version (3.7.4-2~16.04.york1).
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
libpython3.7 : Depends: libpython3.7-stdlib (= 3.7.4-2~16.04.york1) but 3.7.4-1+xenial2 is to be installed
libpython3.7-dev : Depends: libpython3.7-stdlib (= 3.7.4-2~16.04.york1) but 3.7.4-1+xenial2 is to be installed
libpython3.7-stdlib : Depends: libpython3.7-minimal (= 3.7.4-1+xenial2) but 3.7.4-2~16.04.york1 is to be installed
python3.7 : Depends: libpython3.7-stdlib (= 3.7.4-2~16.04.york1) but 3.7.4-1+xenial2 is to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
之后,我尝试按照上述输出中的建议执行“apt-get -f install”,但随后得到以下结果:-
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
libpython3.7-stdlib
The following packages will be upgraded:
libpython3.7-stdlib
1 upgraded, 0 newly installed, 0 to remove and 209 not upgraded.
4 not fully installed or removed.
Need to get 0 B/1,756 kB of archives.
After this operation, 66.6 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 189831 files and directories currently installed.)
Preparing to unpack .../libpython3.7-stdlib_3.7.4-2~16.04.york1_amd64.deb ...
Unpacking libpython3.7-stdlib:amd64 (3.7.4-2~16.04.york1) over (3.7.4-1+xenial2) ...
dpkg: error processing archive /var/cache/apt/archives/libpython3.7-stdlib_3.7.4-2~16.04.york1_amd64.deb (--unpack):
trying to overwrite '/usr/lib/python3.7/distutils/__init__.py', which is also in package python3.7-distutils 3.7.4-1+xenial2
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Errors were encountered while processing:
/var/cache/apt/archives/libpython3.7-stdlib_3.7.4-2~16.04.york1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
更新:
即使错误表明 python3.7 已经存在,但当我执行时python
,我得到以下信息:
Python 2.7.12 (default, Oct 8 2019, 14:14:10)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
当我运行'python3'时在下面: -
Python 3.5.2 (default, Oct 8 2019, 13:06:37)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
我想做的就是安装python 3.7。
谁能帮我解决这个错误?
解决方案
我在您的日志中看到以下内容
python3.7 is already the newest version (3.7.4-2~16.04.york1).
它说python3.7已经安装。
您可以尝试一下
python
还是python3
在命令行上,看看它说了什么?如果您看到类似下面的内容,则它已成功安装
Python 3.7.3 (v3.7.3 Oct 3 2017, 00:32:08)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on XXX
Type "help", "copyright", "credits" or "license" for more information.
推荐阅读
- javascript - 在 angularjs 组件中使用 Bootstrap 网格
- javascript - .then 没有被承诺这是未定义的
- python - Pandas - 读取 csvs 时忽略格式化的数据类型
- vuejs2 - 多个输入输出单个对象
- excel - 创建一个每日花名册,其中包含一个名单并随机为员工职位分配名称
- macos - MacOS Mojave 上的 Apache Web 服务器问题
- ocaml - 你如何在 OCaml/ReasonML 中获取列表的一部分?
- python - Django ModelForm 无法使用 ModelForm 和 save_m2m 保存“多对多”记录
- rust - 使用 Serde 序列化值时如何执行其他数据库查询?
- python - 计算不等字符串python的最小编辑距离