我正在用 python 创建一个脚本,它将打开一个程序,然后 python 将等待该程序自行关闭,然后再继续执行下一个代码。这是我的脚本:
Import subprocess as sp
sp.Popen([r'C:/Folder/folder/a.exe'])
??????
????????
print("test")
Run Code Online (Sandbox Code Playgroud)
问号是我不知道的事情。
我最近使用以下命令在 Ubuntu 18.04.4 LTS 机器上安装了 python 3.7:
sudo apt-get install python3.7
Run Code Online (Sandbox Code Playgroud)
我还运行了以下命令,因为我希望 python 3.7 运行为python3:
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 1
Run Code Online (Sandbox Code Playgroud)
随后我按照一个建议来运行这个:
sudo apt autoremove
Run Code Online (Sandbox Code Playgroud)
现在,当我尝试启用universe存储库 ( add-apt-repository universe) 时,出现以下错误:
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 28, in <module>
import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'
Run Code Online (Sandbox Code Playgroud)
我找到的大多数答案都告诉我python3-apt像这里和这里一样重新安装,但这不起作用。
我还能尝试什么?
当我尝试使用该类时,出现了上述错误Turtle。我正在学习一个教程,它用于在屏幕上弹出一个窗口。代码很简单:
from turtle import Turtle, Screen
jabba = Turtle()
print(jabba)
my_screen = Screen()
print(my_screen.canvheight)
my_screen.exitonclick()
Run Code Online (Sandbox Code Playgroud)
但在终端中它说:
ModuleNotFoundError: No module named 'tkinter'
Run Code Online (Sandbox Code Playgroud)
我在 Ubuntu 20.04 上使用 PyCharm 专业 IDE。
我正在尝试使用一个名为 mgl-tools 的包,当我运行 ./install.sh 时,它不起作用。几天前它曾经有效。
错误:
./install.sh
Installing MGLTools to /home/aka/Desktop/Expt 10/mgltools_x86_64Linux2_1.5.7
Installing Python Interpreter to
tar (child): /home/aka/Desktop/Expt: Cannot open: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
Error in Python installation
Run Code Online (Sandbox Code Playgroud)
.sh文件的内容:
#!/bin/sh
# MGL Tools installation script
pythonargs=" "
pyoptimize=0
TarDir=`pwd`
export MGL_ROOT=""
# Parse the command-line arguments
opts=`getopt "hlc:d:" "$@"`
if [ "$?" != 0 ]
then
echo "Usage: …Run Code Online (Sandbox Code Playgroud) 我尝试在 Ubuntu 23.04 上将 python3.10 与本机 python3.11 一起安装,但看起来不可用。
mika@system:~$ sudo apt update && sudo apt install python3.10
Hit:1 http://ru.archive.ubuntu.com/ubuntu lunar InRelease
Get:2 http://ru.archive.ubuntu.com/ubuntu lunar-updates InRelease [109 kB]
Hit:3 https://repo.yandex.ru/yandex-browser/deb stable InRelease
Get:4 http://ru.archive.ubuntu.com/ubuntu lunar-backports InRelease [99.8 kB]
Get:5 http://security.ubuntu.com/ubuntu lunar-security InRelease [109 kB]
Fetched 317 kB in 1s (295 kB/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
All packages are up to date.
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done …Run Code Online (Sandbox Code Playgroud) 当我运行命令时 sudo pip3 install -U scikit-learn
我收到一个奇怪的错误。
Cleaning up...
Command /usr/bin/python3 -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/scikit-learn/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-hrwadcyq-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_root/scikit-learn
Storing debug log for failure in /home/donbeo/.pip/pip.log
Run Code Online (Sandbox Code Playgroud)
这里是日志文件的链接。 https://drive.google.com/file/d/0B3FIuCA5bZUaUC1pd21MTUFxWkU/edit?usp=sharing
我不知道如何解决这个问题。
我正在尝试使用 将软件包安装python3-dateutil在 Ubuntu 12.04.4 LTS(精确)中aptitude,但我在任何地方都找不到它。我该如何安装?
在 Ubuntu 14.04 中,我设置python3.4为默认python版本。之后,Dropbox 不会在启动时启动,Ubuntu 软件中心也无法再打开。从命令行运行它们,我有:
petrux@MYMACHINE:~$ dropbox
File "/usr/bin/dropbox", line 232
except OSError, e:
^
SyntaxError: invalid syntax
petrux@orion:~$ software-center
File "/usr/bin/software-center", line 140
print time.time()
^
SyntaxError: invalid syntax
Run Code Online (Sandbox Code Playgroud)
我该如何解决这个问题?
编辑:我刚刚注意到,此外,没有音频输出了。
我的机器上已经安装了 python 2.7。我不记得是我安装了它还是内置安装。无论如何,我想使用 python 3.x 安装工作,我想知道我是否需要先卸载 2.7 版本。系统中是否有依赖此版本的组件?
谢谢。
我找不到 PPA,而 pyaudio 0.2.7 是随附的