当我尝试创建 venv 时,它会抛出此错误:
When I try to create venv it throws this error:
错误:命令 '['C:\Users\admin\env\Scripts\python.exe', '-Im', 'ensurepip', '--upgrade', '--default-pip']' 返回非零退出状态 1.
我很奇怪,因为我用python很久了,从来没有遇到过这样的问题.
It is strange for me because I'm using python for a long time and never had such a problem.
1- 顶一下 doc 并尝试相应地修复您的全局 python 安装,不要忘记检查 Install launcher for all users 选项,成功安装后 py 启动器 将本地化在 C:Windows 文件夹下.
1- head over this doc and try to refix your global python installation accordingly, don't forget to check Install launcher for all users option, after successful installation the py launcher will be localed under C:Windows folder.
2- 使用隔离的虚拟环境,venv 内置模块比其他第三个工具更推荐,避免弄乱你的全局 python 文件夹.
2- use isolated vrtual environement, venv built-in module is recommended over other 3rd tools and just avoid to mess with your global python folder.
PS c:YOUR_PROJECT_FOLDER> py --version
PS c:YOUR_PROJECT_FOLDER> py -0p # many python version (3.8.x, 3.9.X, 3.10.x ..) can co-exist without any conflict
PS c:YOUR_PROJECT_FOLDER> py -m venv venv
PS c:YOUR_PROJECT_FOLDER> .venvScriptsactivate
(venv) PS c:YOUR_PROJECT_FOLDER> pip list
Package Version
---------- -------
pip 20.2.3
setuptools 49.2.1
WARNING: You are using pip version 20.2.3; however, version 21.3 is available.
You should consider upgrading via the 'c:usersUSERdesktopYOUR_PROJECT_FOLDERvenvscriptspython.exe -m pip install --upgrade pip' command.
# Here just copy/past that link to update the local pip of your virtual environment
(venv) PS c:YOUR_PROJECT_FOLDER> c:usersUSERdesktopYOUR_PROJECT_FOLDERvenvscriptspython.exe -m pip install --upgrade pip
Collecting pip
Using cached pip-21.3-py3-none-any.whl (1.7 MB)
Installing collected packages: pip
Attempting uninstall: pip
Found existing installation: pip 20.2.3
Uninstalling pip-20.2.3:
Successfully uninstalled pip-20.2.3
Successfully installed pip-21.3
(venv) PS c:YOUR_PROJECT_FOLDER> pip list
Package Version
---------- -------
pip 21.3
setuptools 49.2.1
(venv) PS c:YOUR_PROJECT_FOLDER> pip install <PYTHON_PACKAGE>
这篇关于创建 venv 时出错,错误:命令 '-Im'、'ensurepip'、'--upgrade'、'--default-pip']' 返回非零退出状态 1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
如何制作一个在 Python 中提供角色的不和谐机器人How to make a discord bot that gives roles in Python?(如何制作一个在 Python 中提供角色的不和谐机器人?)
Discord 机器人没有响应命令Discord bot isn#39;t responding to commands(Discord 机器人没有响应命令)
你能得到“关于我"吗?Discord 机器人的功能?Can you Get the quot;About mequot; feature on Discord bot#39;s? (Discord.py)(你能得到“关于我吗?Discord 机器人的功能?(不和谐.py))
message.channel.id Discord PYmessage.channel.id Discord PY(message.channel.id Discord PY)
如何在 heroku 上托管我的 discord.py 机器人?How do I host my discord.py bot on heroku?(如何在 heroku 上托管我的 discord.py 机器人?)
discord.py - 自动更改角色颜色discord.py - Automaticaly Change an Role Color(discord.py - 自动更改角色颜色)