我现在默认安装的 Ubuntu 当前版本的 python 是 2.7rc1 ,
是否可以将其正式更新到最新版本(3.7.1)?
谢谢你 。
根据 Python 的官方文档,Python2.7 的支持将在不久的将来结束。
弃用:Python 2.7 的生命周期将于 2020 年 1 月 1 日结束。请升级您的 Python,因为在该日期之后将不再维护 Python 2.7。pip 的未来版本将不再支持 Python 2.7。有关 pip 中 Python 2 支持的更多详细信息,请访问https://pip.pypa.io/en/latest/development/release-process/#python-2-support
为什么 Ubuntu 在即将推出的版本中不使用 Python3 作为默认设置?
$ cat /etc/os-release
NAME="Ubuntu"
VERSION="19.04 (Disco Dingo)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 19.04"
VERSION_ID="19.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=disco
UBUNTU_CODENAME=disco
Run Code Online (Sandbox Code Playgroud)
$ python
Python 2.7.16 (default, Apr 6 2019, 01:42:57)
[GCC 8.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Run Code Online (Sandbox Code Playgroud) sudo apt-get install python-pip
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package python-pip
Run Code Online (Sandbox Code Playgroud)
如何在 ubuntu:14.04 中安装 python-pip?
在 2010 年 Stefano Palazzo 提出了一个相关的问题,将任意 gtk.Widget 放入 appindicator.Indicator 中,并且在StackOverflow上也提出了类似的问题。在这两种情况下,共识是 Ubuntu 的应用程序指标是有限的。正如迈克尔·埃克斯特兰德所说:
Application Indicator 菜单支持基于 D-Bus 菜单,它们支持的内容有限——它们只支持基本的菜单功能,不支持更多奇特的东西,比如任意小部件。
然而,它与我们今天在 2016 年看到的蓝牙指示器相矛盾:它使用拨动开关。
13.04 中的 Ubuntu One 指标也可以观察到相同的情况:
所以显然有办法。我研究了指标蓝牙源代码,但它是用 Vala 编写的。但是,我主要使用 Python 工作,学习 Vala 只是为了重写我现有的所有指标,工作量太大了。
所以问题的核心是:如何使用 Python 使用 Gtk.Widgets,或者至少像蓝牙指示器中的切换开关一样?
注意:我愿意在这个问题上悬赏以奖励一个答案,该答案将在 python 中提供一个工作示例。不接受其他语言。
我只是尝试在我的 Ubuntu 16.04 系统上安装 python 3.6,现在我无法从启动器或Ctrl + Alt + T. 我尝试gnome-terminal从 XTerm运行并收到以下消息:
Traceback (most recent call last):
File "/usr/bin/gnome-terminal", line 9, in <module>
from gi.repository import GLib, Gio
File "/usr/lib/python3/dist-packages/gi/__init__.py", line 42, in <module>
from . import _gi
ImportError: cannot import name '_gi'
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
from apport.fileutils import likely_packaged, get_recent_crashes
File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
from apport.report import Report
File "/usr/lib/python3/dist-packages/apport/report.py", line 30, …Run Code Online (Sandbox Code Playgroud) 我正在从 13.10 升级到 14.04(现在是 dev,几个小时后稳定)使用do-release-upgrade并遇到以下问题:
Can not upgrade
Your python install is corrupted. Please fix the '/usr/bin/python' symlink.
Run Code Online (Sandbox Code Playgroud)
经过一番折腾,我解决了这个问题,所以我想在这里分享我的解决方案。希望这可以帮助某人。
如何在 Ubuntu 上安装 python 映像库 (PIL)?
我试着做
sudo apt-get install python-imaging
Run Code Online (Sandbox Code Playgroud)
但是现在当我运行 python selftest.py(我从http://pythonware.com/products/pil/网站上的某个地方获得的脚本)时,我得到(以及其他警告消息):
...
*** JPEG support not installed
*** ZLIB (PNG/ZIP) support not installed
...
*** 1 tests of 57 failed.
Run Code Online (Sandbox Code Playgroud)
我是否以某种方式弄乱了 PIL - 我该如何解决?
也许 PIL 就好了,但是“selftest.py”并不是用于检查 PIL 是否安装正确的正确程序——我还能如何判断 PIL 是否安装正确?
(我使用的是 Ubuntu 12.04 LTS“精确穿山甲”)。
(我最终想要做的是在一些 python 代码中添加一个二维条码生成器,我能找到的所有用 python 编写的二维条码生成器似乎都使用了 PIL)。
我需要将 grep 命令的结果保存到一个文件中,但我也希望输出文件被格式化并保持颜色就像在终端中一样。
有没有办法做到这一点?也许将 grep 保存为某种标记语言?如果不可能,是否有其他工具可以完成此任务?
我试图让搜索关键字在输出文件中脱颖而出,就像在终端中一样。
这不是如何创建 Unity 指标的副本?. 我正在寻找系统指示器而不是应用程序指示器。
背景:
从这两个问题来看:
我了解到有两种类型的指标:
ps ax | grep indicator)所有应用程序指标都由指标应用程序(系统应用程序)处理/显示。系统指标由 Unity 面板直接显示。
这两个问题都是关于从登录和锁定屏幕添加/删除指标。第一个是直接设置(在处理系统指标时)。第二个是一个艰难的设置(在处理应用程序指标时),需要修改锁屏面板服务(unity包)的源和登录屏幕的 unity-greeter 源。
对于sysmonitor,对我来说这是解决方法。最好的解决方案是实施系统指标而不是应用指标。
话题:
是否有统一的系统指标 API(最好:Python 然后 C/C++)?请参考官方文档。
大多数系统指标是使用 Vala 编程语言编写的。有人可以使用 Python 或 C 为系统指标编写小演示吗?
更新:
我发现了几个可以推动的链接:
我想安装JetBrains for Python(免费社区版)的PyCharm IDE。
我设法下载了 PyCharm 社区版,但我不知道如何安装它。你能帮我么?