Python version: 3.10.11
OS Version: Windows10 22H2 19045.3208
When trying to create a virtual environment using the venv module without an administrator user, it reports the error below, when trying to execute the error command, it says “[WinError 5] Access is denied”. Anyone can give guidance?
I know using administrative commands can solve from the root, but it is tricky to promote in my team.
D:\Projects\Python>python -m venv --system-site-packages Training3 Django3_4 Flask3_2
Error: Command '['D:\\Projects\\Python\\Training3\\Scripts\\python.exe', '-m', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1.
D:\Projects\Python>cd Training3\Scripts
D:\Projects\Python\Training3\Scripts>python -m ensurepip --upragde --default-pip
usage: python -m ensurepip [-h] [--version] [-v] [-U] [--user] [--root ROOT] [--altinstall] [--default-pip]
python -m ensurepip: error: unrecognized arguments: --upragde
D:\Projects\Python\Training3\Scripts>python -m ensurepip --upgrade --default-pip
Looking in links: c:\Users\TODD_Z~1\AppData\Local\Temp\tmpxq52alt2
ERROR: Could not install packages due to an OSError: [WinError 5] Access is denied
Check the permissions.
Traceback (most recent call last):
File "D:\Program Files\Python310\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "D:\Program Files\Python310\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "D:\Program Files\Python310\lib\ensurepip\__main__.py", line 5, in <module>
sys.exit(ensurepip._main())
File "D:\Program Files\Python310\lib\ensurepip\__init__.py", line 287, in _main
return _bootstrap(
File "D:\Program Files\Python310\lib\ensurepip\__init__.py", line 203, in _bootstrap
return _run_pip([*args, *_PACKAGE_NAMES], additional_paths)
File "D:\Program Files\Python310\lib\ensurepip\__init__.py", line 104, in _run_pip
return subprocess.run(cmd, check=True).returncode
File "D:\Program Files\Python310\lib\subprocess.py", line 526, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['D:\\Projects\\Python\\Training3\\Scripts\\python.exe', '-W', 'ignore::DeprecationWarning', '-c', '\nimport runpy\nimport sys\nsys.path = [\'C:\\\\Users\\\\TODD_Z~1\\\\AppData\\\\Local\\\\Temp\\\\tmpxq52alt2\\\\setuptools-65.5.0-py3-none-any.whl\', \'C:\\\\Users\\\\TODD_Z~1\\\\AppData\\\\Local\\\\Temp\\\\tmpxq52alt2\\\\pip-23.0.1-py3-none-any.whl\'] + sys.path\nsys.argv[1:] = [\'install\', \'--no-cache-dir\', \'--no-index\', \'--find-links\', \'C:\\\\Users\\\\TODD_Z~1\\\\AppData\\\\Local\\\\Temp\\\\tmpxq52alt2\', \'--upgrade\', \'setuptools\', \'pip\']\nrunpy.run_module("pip", run_name="__main__", alter_sys=True)\n']' returned non-zero exit status 1.