@TOC
D:\Desktop\pycharm-projects\venv1
改成C:\Users\Xu Han\Desktop\pycharm-projects\venv1
,然后尝试在虚拟环境中pip list
,报错如下:Fatal error in launcher: Unable to create process using '"D:\Desktop\pycharm-projects\venv1\venv\Scripts\python.exe" "C:\Users\Xu Han\Desktop\pycharm-projects\venv1\venv\Scripts\pip.exe" list': ???????????
venv\Scripts
这个文件夹,查找替换成现在的路径即可,如下:python -m ensurepip
是不管用的(venv) PS C:\Users\Xu Han\Desktop\pycharm-projects\venv1> python -m ensurepip Looking in links: c:\Users\XUHAN~1\AppData\Local\Temp\tmpr6ouww8y Requirement already satisfied: setuptools in c:\users\xu han\desktop\pycharm-projects\venv1\venv\lib\site-packages (60.2.0) Requirement already satisfied: pip in c:\users\xu han\appdata\local\programs\python\python39\lib\site-packages (23.1)
(venv) PS C:\Users\Xu Han\Desktop\pycharm-projects\venv1> python -m pip uninstall pip
如果你遇到了第一个bug,已经删除了venv\Lib\site-packages\pip
和venv\Lib\site-packages\pip-23.3.1.dist-info
,就不用卸载了
python.exe -m pip install --upgrade
,升级的途中会自动安装:(venv) PS C:\Users\Xu Han\Desktop\pycharm-projects\venv1> python.exe -m pip install --upgrade pip Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple Requirement already satisfied: pip in c:\users\xu han\appdata\local\programs\python\python39\lib\site-packages (23.1) Collecting pip Using cached https://pypi.tuna.tsinghua.edu.cn/packages/47/6a/453160888fab7c6a432a6e25f8afe6256d0d9f2cbd25971021da6491d899/pip-23.3.1-py3-none-any.whl (2.1 MB) Installing collected packages: pip Attempting uninstall: pip Found existing installation: pip 23.1 Not uninstalling pip at c:\users\xu han\appdata\local\programs\python\python39\lib\site-packages, outside environment C:\Users\Xu Han\Desktop\pycharm-projects\venv1\venv Can't uninstall 'pip'. No files were found to uninstall. Successfully installed pip-23.3.1 [notice] A new release of pip is available: 23.1 -> 23.3.1 [notice] To update, run: python.exe -m pip install --upgrade pip
PS C:\Users\Xu Han\Desktop\pycharm-projects\venv1> ./venv/Scripts/activate
(venv) PS C:\Users\Xu Han\Desktop\pycharm-projects\venv1> ./venv/Scripts/deactivate
本文由博客一文多发平台 OpenWrite 发布!