在 18.04(从 16.04 升级)python3 中安装后,我删除了 python2
sudo apt autoremove python2
sudo apt autoremove python2.7
我现在意识到这是愚蠢的。但我不明白为什么 GIMP 现在不再工作了。重新安装 GIMP 就够了吗?我应该再次安装python2吗?
在 18.04(从 16.04 升级)python3 中安装后,我删除了 python2
sudo apt autoremove python2
sudo apt autoremove python2.7
我现在意识到这是愚蠢的。但我不明白为什么 GIMP 现在不再工作了。重新安装 GIMP 就够了吗?我应该再次安装python2吗?
我想运行一个使用python2.7版本的应用程序,但默认没有安装python2.7。当我尝试使用时:
$ virtualenv -p python2 flaskold
它返回:
RuntimeError: failed to find interpreter for Builtin discover of python_spec='python2'
如何在没有 python 2.7 支持的 Ubuntu 20.04 上创建 python2.7 虚拟环境?
我已经尝试并再次尝试正确安装 Pycharm 的软件包。我对 Python2.7 和 Python3 都使用了 pip,并且我尝试使用 tar 文件。但是 Pycharm 并没有检测到这些模块,即使它们在 Pycharm 之外工作。我该怎么办?
我正在尝试在 Ubuntu 20.04 LTS 上为 gdal 使用 python2 绑定,它的存储库中没有 python-gdal 包,以运行旧的 python2 应用程序。
我尝试从 Ubuntu 18.04 LTS 存储库下载并安装它:
sudo wget -c http://archive.ubuntu.com/ubuntu/pool/universe/g/gdal/python-gdal_2.2.3+dfsg-2_amd64.deb
sudo apt install ./python-gdal_2.2.3+dfsg-2_amd64.deb
但是得到了错误:
The following packages have unmet dependencies. python-gdal : Depends: gdal-abi-2-2-3 but it is not installable Depends: libgdal20 (>= 2.2.2) but it is not installable E: Unable to correct problems, you have held broken packages.
我也运行sudo apt-get dist-upgrade
并apt-cache policy python-gdal libgdal20
输出:
python-gdal: Installed: (none) Candidate: (none) Version table: libgdal20: Installed: (none) Candidate: (none) Version table:
有什么方法可以使用 python-gdal 在 Ubuntu 20 上运行应用程序而不会发生冲突?
我正在尝试启动一个旧的 python2 脚本。在 ubuntu 18.04 上,我安装了 python-glade2 并且它工作正常,不幸的是 ubuntu 20.04 在存储库中没有它。有没有办法得到这个 gtk.glade 模块?也许其他一些提供它的图书馆?
@edit:在按照 N0rbert 的建议安装了 gtk/glade 但不幸的是,我还需要 python-gdal,我试图以类似的方式安装它并出现错误:
The following packages have unmet dependencies. python-gdal : Depends: gdal-abi-2-2-3 but it is not installable Depends: libgdal20 (>= 2.2.2) but it is not installable E: Unable to correct problems, you have held broken packages.
我假设我需要的一些来自 Ubuntu 20 的软件包与来自 ubuntu 18 的软件包发生冲突。
输出apt-cache policy python-gdal libgdal20
:
python-gdal: Installed: (none) Candidate: (none) Version table: libgdal20: Installed: (none) Candidate: (none) Version table:
我想知道是否从 ubuntu 18 下载 .debs,然后仅提取 .py 文件并将它们复制到脚本目录中是唯一的选择 -
我最近从 Ubuntu 18.04 升级到了 20.04。但是我可以看到 Python2 仍然是默认的,而不是 python 3.8.2。
$ python -V
Python 2.7.18rc1
$ python3 -V
Python 3.8.2
是否可以删除 python 2 并用 Python 3.8 替换它?
编辑:我一直在我的 ubuntu 18.04 中使用以下别名:
alias python='python3'
alias pip='pip3'
升级后,我删除了这些别名,因为我认为 python2 应该不再存在但它仍然存在。
谢谢
旧版本的 Ubuntu 附带 python 2.7 和 python 3.6。但是在 Ubuntu 20.04 LTS 中,只安装了 python 3.8。所以当python
在终端输入时,python3.8 打开了。python
,python3
并python3.8
做了同样的打开python3.8的工作。
但后来当我安装 python2.7 时,它弄乱了python
命令。当我使用python
命令时,python2.7 开始打开。现在要使用 python3.8 我需要python3
或python3.8
.
有人能解释一下为什么python
command 改变了它的目标应用程序吗?
Ubuntu(早于 20.04 LTS)附带 Python 3 和 python 2。当python
在终端中输入时,python2.7 会打开,而要打开 python 3.6,python3
则需要命令。然而python3.6
也有效。
所以我的疑问是为什么python3
两者python3.6
都有效?从技术上讲,因为我安装了 python3.6,所以python3.6
应该可以工作。但是为什么python3
也有效呢?
编辑 1
当我键入python
并按两次制表符(显示可能的命令)时,我同时看到了 python3 和 python3.8。
python3
我的疑问是命令和python3.6
命令在执行中的区别是什么。
pip install pygame
根据本文档,我正在尝试运行。我收到了一个错误Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-vD9diA/pygame/
,以及一些关于找不到配置文件的信息。我运行了这些命令来解决丢失的配置文件问题:
% sudo apt install libfreetype6-dev
% sudo apt install libsdl1.2-dev
% sudo apt install libmysqlclient-dev
% sudo apt install python-mysqldb
现在运行时出现以下错误pip install pygame
:
Collecting pygame
Using cached https://files.pythonhosted.org/packages/0f/9c/78626be04e193c0624842090fe5555b3805c050dfaa81c8094d6441db2be/pygame-1.9.6.tar.gz
Complete output from command python setup.py egg_info:
WARNING, No "Setup" File Exists, Running "buildconfig/config.py"
Using UNIX configuration...
Hunting dependencies...
SDL : found 1.2.15
FONT : not found
IMAGE : not found
MIXER : not found
PNG : found
JPEG : not found
SCRAP : found
PORTMIDI: not found
PORTTIME: not found
FREETYPE: found 21.0.15
Missing dependencies
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-e36J9A/pygame/
pip install --upgrade setuptools
: 输出没有变化pip install --upgrade pip
:中断 pip,必须调用python -m pip uninstall pip
才能撤消。这是pip install pygame
我卸载之前的输出:
警告:旧脚本包装器正在调用 pip。这将在 pip 的未来版本中失败。请参阅https://github.com/pypa/pip/issues/5599以获取有关解决潜在问题的建议。为避免此问题,您可以使用“-m pip”调用 Python,而不是直接运行 pip。弃用:Python 2.7 已于 2020 年 1 月 1 日结束其生命周期。请升级您的 Python,因为不再维护 Python 2.7。pip 21.0 将于 2021 年 1 月停止对 Python 2.7 的支持。有关 pip 中 Python 2 支持的更多详细信息,请访问https://pip.pypa.io/en/latest/development/release-process/#python-2-支持 默认用户安装,因为普通站点包不可写要求已经满足:/usr/lib/python2.7/dist-packages(1.9.1release)中的pygame
sudo apt-get build-dep python-pygame
正如https://askubuntu.com/a/312779/1065820推荐的那样:产生这个输出:
正在阅读包列表...完成 E:您必须在 sources.list 中放入一些“源”URI
sudo apt-get install python-setuptools
和sudo apt-get install python-dev
:两者都已经是最新版本,所以没有变化
在这一点上,我已经查看了几十个帮助页面并且我的想法已经不多了。任何建议表示赞赏。