默认为用户安装,因为普通站点包不可写。 (Linux)

发布于 2025-01-18 10:23:45 字数 2373 浏览 3 评论 0原文

系统:Fedora 36
在创建 Discord 机器人的过程中,我安装了 pip,然后运行命令:

pip install discord

终端中出现了一些进度条内容,很快就安装了 Discord。 但是,等一下,我仍然看到我无法在 VS Code 中使用不和谐库。我在终端中再次运行该命令。输出是:

Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: discord in /home/Satyam/.local/lib/python3.10/site-packages (1.7.3)
Requirement already satisfied: discord.py>=1.7.3 in /home/Satyam/.local/lib/python3.10/site-packages (from discord) (1.7.3)
Requirement already satisfied: aiohttp<3.8.0,>=3.6.0 in /home/Satyam/.local/lib/python3.10/site-packages (from discord.py>=1.7.3->discord) (3.7.4.post0)
Requirement already satisfied: multidict<7.0,>=4.5 in /home/Satyam/.local/lib/python3.10/site-packages (from aiohttp<3.8.0,>=3.6.0->discord.py>=1.7.3->discord) (6.0.2)
Requirement already satisfied: async-timeout<4.0,>=3.0 in /home/Satyam/.local/lib/python3.10/site-packages (from aiohttp<3.8.0,>=3.6.0->discord.py>=1.7.3->discord) (3.0.1)
Requirement already satisfied: attrs>=17.3.0 in /home/Satyam/.local/lib/python3.10/site-packages (from aiohttp<3.8.0,>=3.6.0->discord.py>=1.7.3->discord) (21.4.0)
Requirement already satisfied: yarl<2.0,>=1.0 in /home/Satyam/.local/lib/python3.10/site-packages (from aiohttp<3.8.0,>=3.6.0->discord.py>=1.7.3->discord) (1.7.2)
Requirement already satisfied: chardet<5.0,>=2.0 in /usr/lib/python3.10/site-packages (from aiohttp<3.8.0,>=3.6.0->discord.py>=1.7.3->discord) (4.0.0)
Requirement already satisfied: typing-extensions>=3.6.5 in /home/Satyam/.local/lib/python3.10/site-packages (from aiohttp<3.8.0,>=3.6.0->discord.py>=1.7.3->discord) (4.1.1)
Requirement already satisfied: idna>=2.0 in /usr/lib/python3.10/site-packages (from yarl<2.0,>=1.0->aiohttp<3.8.0,>=3.6.0->discord.py>=1.7.3->discord) (3.3)

浏览文章 https://itsmycode.com/solved-defaulting-to-user-installation-because-normal-site-packages-is-not-writeable/ 我发现这可能是由于两个版本造成​​的python安装在我的机器。文章中也列出了解决方案。我尝试过,但第一个对我不起作用。对于第二个解决方案,我不喜欢每次开始新项目时都这样做。

那么,有没有办法管理 python 的两个冲突版本呢?

System: Fedora 36
On my way to create a discord bot, I installed pip and then ran the command:

pip install discord

There was some progress bar stuff in the terminal and soon the discord was installed.
But, wait a minute, I still see that I could not use discord library in VS Code. I ran the command again in the terminal. The output was:

Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: discord in /home/Satyam/.local/lib/python3.10/site-packages (1.7.3)
Requirement already satisfied: discord.py>=1.7.3 in /home/Satyam/.local/lib/python3.10/site-packages (from discord) (1.7.3)
Requirement already satisfied: aiohttp<3.8.0,>=3.6.0 in /home/Satyam/.local/lib/python3.10/site-packages (from discord.py>=1.7.3->discord) (3.7.4.post0)
Requirement already satisfied: multidict<7.0,>=4.5 in /home/Satyam/.local/lib/python3.10/site-packages (from aiohttp<3.8.0,>=3.6.0->discord.py>=1.7.3->discord) (6.0.2)
Requirement already satisfied: async-timeout<4.0,>=3.0 in /home/Satyam/.local/lib/python3.10/site-packages (from aiohttp<3.8.0,>=3.6.0->discord.py>=1.7.3->discord) (3.0.1)
Requirement already satisfied: attrs>=17.3.0 in /home/Satyam/.local/lib/python3.10/site-packages (from aiohttp<3.8.0,>=3.6.0->discord.py>=1.7.3->discord) (21.4.0)
Requirement already satisfied: yarl<2.0,>=1.0 in /home/Satyam/.local/lib/python3.10/site-packages (from aiohttp<3.8.0,>=3.6.0->discord.py>=1.7.3->discord) (1.7.2)
Requirement already satisfied: chardet<5.0,>=2.0 in /usr/lib/python3.10/site-packages (from aiohttp<3.8.0,>=3.6.0->discord.py>=1.7.3->discord) (4.0.0)
Requirement already satisfied: typing-extensions>=3.6.5 in /home/Satyam/.local/lib/python3.10/site-packages (from aiohttp<3.8.0,>=3.6.0->discord.py>=1.7.3->discord) (4.1.1)
Requirement already satisfied: idna>=2.0 in /usr/lib/python3.10/site-packages (from yarl<2.0,>=1.0->aiohttp<3.8.0,>=3.6.0->discord.py>=1.7.3->discord) (3.3)

After going through the article https://itsmycode.com/solved-defaulting-to-user-installation-because-normal-site-packages-is-not-writeable/ I found that this was probably due to two versions of python installed on my machine. Solutions were listed in the article as well. I tried but the first one didn't work for me. For the second solution, I didn't prefer to do it each time I started a new project.

So, is there a way to manage the two clashing versions of python?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文