'Returned non zero exit status 101 giving an error when I tried create a Virtual environment
When I run py -3 -m venv venv on command prompt to create a virtual environment it fails.
"Error: Command '['C:\\Users\\Guest\\Desktop\\Python Web
App\\venv\\Scripts\\python.exe', '-Im', 'ensurepip', '--upgrade', '--default-
pip']' returned non-zero exit status 101.
How to fix this? I've installed the latest Python Version. I'm stuck here on my way to set up Flask for web development.
Solution 1:[1]
This happened after I upgraded from python3.8 to python3.9.
sudo apt install python3.9-venv
should solve the issue
Solution 2:[2]
I had this problem - the workaround was to uninstall Python and reinstall it with the Install for all users option. See my longer answer: https://stackoverflow.com/a/62207756/11308690
Solution 3:[3]
I tried reinstalling python to no avail. This problem seems to occur when copying the python executable doesn't work (fully) for whatever reason. I recreated my venv with the --clear --symlinks:
python -m venv --clear --symlinks ./venv
Solution 4:[4]
I also faced the same problem after upgrading to python 3.9.2 "Error: Command '['C:\Users\Chicool Ph G\PycharmProjects\InvenoryTrackingSystem\venv\Scripts\python.exe', '-Im', 'ensurepip', '--upgrade', '--default- pip']' returned non-zero exit status 101"
It worked;
- unistall the Python 3.9.2
- reinstall the Python 3.9.2
- Select Custom install
- Check(Tick) install for all users
- Click install
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | half of a glazier |
| Solution 2 | tttjj |
| Solution 3 | Mattwmaster58 |
| Solution 4 | Chicool |
