我想使用以下命令在我的 ubuntu 上安装 moka 主题:
sudo add-apt-repository ppa:moka/stable
Run Code Online (Sandbox Code Playgroud)
但得到错误:
Original exception was:
Traceback (most recent call last):
File "/usr/bin/add-apt-repository", line 11, in <module>
from softwareproperties.SoftwareProperties import SoftwareProperties, shortcut_handler
File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 27, in <module>
import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'
Run Code Online (Sandbox Code Playgroud)
python -V: 2.7.6
python3 -V: 3.6.3
我该怎么办?
嗨,我正在尝试在我的 16.04 云映像上安装 python2.7.6。它给出了以下内容on - apt install python=2.7.6
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package python
Run Code Online (Sandbox Code Playgroud) 我正在使用 Ubuntu 16.04.1。我运行了这个命令:
sudo apt-get update
sudo apt-get install python3.6
Run Code Online (Sandbox Code Playgroud)
我将我的 Python 3.6 从 升级3.6.2到3.6.5
但是 Python3.6.6自 2018-06-27 起可用 我该如何安装它?如此重要的包不在存储库中有意义吗?
这对我很重要,因为3.6.6修复了我在代码中遇到的错误。
跑步apt-cache policy python3.6 给予:
python3.6:
Installed: 3.6.5-5~16.04.york1
Candidate: 3.6.5-5~16.04.york1
Version table:
*** 3.6.5-5~16.04.york1 500
500 http://ppa.launchpad.net/jonathonf/python-3.6/ubuntu xenial/main amd64 Packages
100 /var/lib/dpkg/status
Run Code Online (Sandbox Code Playgroud)
我也得到:
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 …Run Code Online (Sandbox Code Playgroud) 我已经在服务器机器上安装了 Python 3,我想用 Python 2.7 替换它,因为我必须部署的代码是对 Python 2.7 的抱怨。
我应该运行什么命令以便 Python application.py 在 Python 2.7 上运行它?
我应该如何解决这个错误?
$ python tensorboard_viz.py
/scratch/sjn-p3/anaconda/anaconda3/lib/python3.6/site-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
from ._conv import register_converters as _register_converters
2018-10-24 19:49:39.925967: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
2018-10-24 19:49:40.093637: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1411] Found device 0 with properties:
name: GeForce GTX 1080 Ti major: 6 minor: 1 memoryClockRate(GHz): 1.6705
pciBusID: 0000:05:00.0
totalMemory: 10.92GiB freeMemory: 10.03GiB …Run Code Online (Sandbox Code Playgroud) 我不小心从 Python 3 中删除了/etc,现在我丢失了许多重要的文件夹、程序和 Gnome shell。我知道,我很笨。
我仍然可以使用我的用户登录,但现在一切都是这样的:
我相信正确的解决方案是再次安装 ubuntu 18.04。
由于我的$HOME文件夹没有损坏(我保留的所有内容:见下面的截图)我想将它复制到闪存驱动器,这样我就可以再次安装 Ubuntu 而不会丢失我的个人文件。
但是当我插入 USB 闪存驱动器时,它显示了以下消息:
[ 264.065197] sd 6:0:0:0: [sdb] Asking for cache data failed
[ 264.065242] sd 6:0:0:0: [sdb] Assuming drive cache: write through
Run Code Online (Sandbox Code Playgroud)
如何使用此终端解决此问题以将我的家复制到闪存驱动器?
不知道有没有办法恢复一切。我认为重新安装它应该会更好,但是如果有另一种解决方案而无需再次重新安装 Ubuntu,请随时分享。
我无法在 ubuntu 18.04.2 上安装 python2,以下是我所做的:
bo@ubuntu18:~$ sudo apt install python
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 resolve the situation:
The following packages have unmet dependencies:
python : PreDepends: python-minimal (= 2.7.15~rc1-1) …Run Code Online (Sandbox Code Playgroud) 我试图从 shell 脚本返回一个字符串到 python 得到以下错误。
./whiptail.sh: 10: return: Illegal number: uuiiu
Run Code Online (Sandbox Code Playgroud)
我尝试在 python 中直接使用 subprocess.Popen 运行whiptail命令,即使那时我无法从 python 读取用户输入..如果有人尝试过这个,请告诉我如何解决这个问题。
外壳脚本片段
#!/bin/sh
COLOR=$(whiptail --inputbox "What is your favorite Color?" 8 78 Blue --title "Example Dialog" 3>&1 1>&2 2>&3)
# A trick to swap stdout and stderr.
# Again, you can pack this inside if, but it seems really long for some 80-col terminal users.
exitstatus=$?
if [ $exitstatus = 0 ]; then
echo "User selected Ok and entered " $COLOR
return $COLOR …Run Code Online (Sandbox Code Playgroud) 我应该如何在 Ubuntu 20.04 中解决这个问题?
Invalid MIT-MAGIC-COOKIE-1 keyqt.qpa.xcb: could not connect to display :0
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, webgl, xcb.
Aborted (core dumped)
Invalid MIT-MAGIC-COOKIE-1 keyqt.qpa.xcb: could not connect to display :0
qt.qpa.plugin: Could not …Run Code Online (Sandbox Code Playgroud) 我正在尝试将我的桌面从 ubuntu 16.04 升级到 18.04。
(很遗憾没有在ubuntu 16.04 EOL到来之前提前升级。两周前我已经将两个16.04笔记本升级到18.04,尽管是在EOL之后,当时我只能解决一些小问题)。
我做了,sudo apt update但在那apt upgrade之后我收到了下面的错误。
ckim@chan-ubuntu:~/prj/abdsn$ sudo apt upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages were automatically installed and are no longer required:
cpp-5-aarch64-linux-gnu cpp-aarch64-linux-gnu cuda-command-line-tools-10-0 cuda-compiler-10-0 cuda-cublas-10-0 cuda-cublas-dev-10-0 cuda-cudart-10-0
cuda-cudart-dev-10-0 cuda-cufft-10-0 cuda-cufft-dev-10-0 cuda-cuobjdump-10-0 cuda-cupti-10-0 cuda-curand-10-0 cuda-curand-dev-10-0 cuda-cusolver-10-0
cuda-cusolver-dev-10-0 cuda-cusparse-10-0 cuda-cusparse-dev-10-0 cuda-documentation-10-0 cuda-driver-dev-10-0 cuda-gdb-10-0
cuda-gpu-library-advisor-10-0 cuda-libraries-10-0 cuda-libraries-dev-10-0 cuda-license-10-0 cuda-memcheck-10-0 cuda-misc-headers-10-0 cuda-npp-10-0
cuda-npp-dev-10-0 cuda-nsight-10-0 cuda-nsight-compute-10-0 cuda-nvcc-10-0 cuda-nvdisasm-10-0 cuda-nvgraph-10-0 cuda-nvgraph-dev-10-0 …Run Code Online (Sandbox Code Playgroud)