我使用 Ubuntu 20.04 进行全新安装并使用 Python3。我曾经安装过 PIPsudo apt install python3-pip. 我总是使用“pip3”,因为“pip”不存在,它提醒我只安装了Python 3(默认情况下)。
我输入pip3 install --upgrade pip想要检查/升级 pip3:
myname@name-X570-AORUS-ULTRA:~/Desktop$ pip3 install --upgrade pip\nCollecting pip\n Downloading pip-20.2.4-py2.py3-none-any.whl (1.5 MB)\n |\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88| 1.5 MB 2.8 MB/s \nInstalling collected packages: pip\nSuccessfully installed pip-20.2.4\nmyname@name-X570-AORUS-ULTRA:\nRun Code Online (Sandbox Code Playgroud)\n我现在无意中安装了两个不同版本的 pip(没有 Python 2.7):
\nmyname@name-X570-AORUS-ULTRA:~/Desktop$ pip --version\npip 20.2.4 from /home/aendie/.local/lib/python3.8/site-packages/pip (python 3.8)\nmyname@name-X570-AORUS-ULTRA:~/Desktop$ pip3 --version\npip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.8)\nmyname@name-X570-AORUS-ULTRA:~/Desktop$\nRun Code Online (Sandbox Code Playgroud)\npip3 list包括pip 20.0.2和\npip list包括pip 20.2.4. 地点还有...
myname@name-X570-AORUS-ULTRA:~/Desktop$ …Run Code Online (Sandbox Code Playgroud) 我有一个运行 16.04 的旧版 Ubuntu 虚拟机。在这个系统上我安装了 python3.5 和 python3.8。似乎默认情况下“python”被解释为 python2.7,而 python3 设置为 python3.5。我希望默认为 3.8,或者至少将默认 python3 更改为 python3.8?如果我这样做,可能会破坏任何东西吗?
我真的应该删除 python3.5 吗?拥有多个版本的 python3 有什么意义吗?
顶部显示某些 python 脚本正在使用所有计算机资源
遗憾的是,我有不止一个正在运行的 python 脚本。我如何识别它正在从哪个文件运行?
我使用top命令获取了PID
我正在为这个问题抓狂。
我不是 python 用户,所以按照随机指示,我找到任何地方可以解决这个问题,但没有任何效果。
基本问题是我正在尝试使用Ensurepip但它不存在。
$ python3 -m ensurepip
/usr/bin/python3: No module named ensurepip
Run Code Online (Sandbox Code Playgroud)
我的 python3 pip 是最新的
$ sudo apt-get install python3-pip
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
python3-pip is already the newest version (23.0.1+dfsg-1).
0 to upgrade, 0 to newly install, 0 to remove and 35 not to upgrade.
Run Code Online (Sandbox Code Playgroud)
我已经看到有关使用 venv 的建议,但不知道如何执行此操作,以便系统上的其他应用程序能够使用它,而无需我对它们执行任何操作,但我不太了解 venv,因此可能会错过观点。
我看到其他人提到 pip 或 Ensurepip 在 ubuntu/debian 上被故意禁用,但不明白为什么这是真的,因为这么多应用程序依赖于使用 pip/ensurepip。
我只是不知道该怎么办。
Kubuntu 23.04
Python 3.11.2
Run Code Online (Sandbox Code Playgroud) 我在终端输入了这个:
sudo apt-get remove python3
Run Code Online (Sandbox Code Playgroud)
它给了我以下输出:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
fonts-dejavu-extra gir1.2-secret-1 icedtea-netx-common libbonobo2-0
libbonobo2-common libcpufreq0 libgconf2-4 libgif4 libgnome2-0 libgnome2-bin
libgnome2-common libgnomevfs2-0 libgnomevfs2-common libidl-common libidl0
liborbit2 tzdata-java
Use 'apt-get autoremove' to remove them.
The following packages will be REMOVED:
apparmor apport apport-gtk aptdaemon apturl apturl-common bluez bluez-alsa
bluez-gstreamer checkbox checkbox-qt command-not-found
deja-dup-backend-ubuntuone dh-python firefox flashplugin-installer
foomatic-db-compressed-ppds friends friends-dispatcher friends-facebook
friends-twitter gedit gnome-bluetooth …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 matplotlib 模块的 Python 3 版本。即使我已经安装了这个包,我也收到关于dateutil不存在的错误。不应该
import dateutil
Run Code Online (Sandbox Code Playgroud)
安装上述软件包后工作吗?我正在使用 Ubuntu 14.04,以防万一。
我试图弄清楚我安装了哪个版本的python,并将其升级到最新版本。
当我转到命令提示符并检查时,看起来我安装了旧版本的 python。
me@linuxdev:~$ python
Python 2.7.8 (default, Oct 20 2014, 15:05:19)
[GCC 4.9.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
Run Code Online (Sandbox Code Playgroud)
但是当我在 Ubuntu 中启动软件中心并检查“已安装”部分时,在“开发人员工具”下我看到“Python (v3.4)”条目
所以我不确定我正在运行什么版本。我想要
谢谢。
编辑 1
当我尝试从命令行重新安装 python 时会发生这种情况:
me@linuxdev:~$ sudo apt-get --reinstall python
E: Command line option --reinstall is not understood
Run Code Online (Sandbox Code Playgroud) 我正在尝试$ ipython3 --pylab在 Ubuntu 14.04 上的 Python 3 中使用 pylab(即)。无论我使用 Tkinter 还是 Qt4 后端,我都遇到了同样的错误。
AttributeError: 'FontManager' object has no attribute 'ttf_lookup_cache'
Run Code Online (Sandbox Code Playgroud)
然而,这个相同的基本绘图例程 ( plt.plot([1,2,3,4])) 在 Python 2 pylab 中工作。
据我所知,我已经安装了必要的依赖项(注意,对于 Python 2 和 Python 3):
sudo apt-get install python-numpy python-scipy python-matplotlib
sudo apt-get install python3-numpy python3-scipy python3-matplotlib
sudo apt-get install python-tk python3-tk
sudo apt-get install libqt4gui libqt4core python-qt4 python3-qt4
Run Code Online (Sandbox Code Playgroud)
下面提供了完整的追溯。这是 Tkinter:
$ ipython3 --matplotlib tk
Python 3.4.0 (default, Apr 11 2014, 13:05:11)
Type "copyright", "credits" or …Run Code Online (Sandbox Code Playgroud) 我试图为 pushbullet 运行一个指标,但无济于事。当我注意到 python3 无法导入 gi 时,我试图通过终端运行
bin > python3 pushbullet-indicator
Traceback (most recent call last):
File "pushbullet-indicator", line 26, in <module>
import gi
ImportError: No module named 'gi'
bin >
Run Code Online (Sandbox Code Playgroud)
尝试手动导入。
~ > python3
Python 3.4.1 (default, Sep 27 2014, 09:00:29)
[GCC 4.8.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import gi
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'gi'
>>>
Run Code Online (Sandbox Code Playgroud)
但出于某种原因,Python2 可以吗?
Python 2.7.6 (default, …Run Code Online (Sandbox Code Playgroud) 这个帖子不仅是关于 pygame 的,也是关于 livewires 的。我按照此链接上的第一个答案进行操作,但是当我编写此命令时 : sudo pip install pygame,我收到一条错误消息:
Could not find any downloads that satisfy the requirement pygame.
Some externally hosted files were ignored (use --allow-external pygame to allow).
Cleaning up...
No distributions at all found for pygame
Storing debug log for failure in /home/cooldudeabhi/.pip/pip.log
Run Code Online (Sandbox Code Playgroud)
如何修复它们。另外,我正在使用python 3.4。请帮我安装两个模块:Pygame 和 livewires。
python3 ×10
python ×4
14.04 ×2
dependencies ×1
matplotlib ×1
pip ×1
process ×1
pygtk ×1
python-2.7 ×1
qt ×1
tkinter ×1
uninstall ×1