question

PranavRavuri-2083 avatar image
0 Votes"
PranavRavuri-2083 asked ·

'Access is denied' while i am running a command in powershell

Hi, I am new to the powershell so this might be an easy question. I am trying to make a python 3.7 virtual environment using virtualenv. to give you a context in already have python 3.8 in my laptop what is also added to the path variable but python 3.7 is not added to the path variable while installation. the command I ran was but I am getting 'Access is denied' error can anyone help.
PS D:\Pranav\Software Output\Python> virtualenv --python="C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Python 3.7" p37\env1
RuntimeError: failed to query C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Python 3.7 with code 13 err: 'Access is denied'

azure-virtual-machines
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

ManuPhilip avatar image
0 Votes"
ManuPhilip answered ·

Try the following syntax

python3 -m venv /path/to/new/virtual/environment

Here is the documentation: https://docs.python.org/3/library/venv.html


Please mark as "Accept the answer" if the above steps helps you. Others with similar issues can also follow the solution as per your suggestion

Regards,

Manu

· Share
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

TKujala avatar image
0 Votes"
TKujala answered ·

Have you verified that you run the command as administrator?

You can also check that you have enough rights to the target (D:\Pranav...}

9155-runas-ps.jpg



runas-ps.jpg (20.8 KiB)
· 11 · Share
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Actually i am using Visual Studio Code9156-untitled.png


0 Votes 0 · ·
untitled.png (27.5 KiB)

Actually, Its not working even then.


9090-untitled.png


0 Votes 0 · ·
untitled.png (29.1 KiB)
ManuPhilip avatar image ManuPhilip PranavRavuri-2083 ·

Hi

Start Windows PowerShell with the "Run as administrator" option.

At the command prompt, type:

Set-ExecutionPolicy AllSigned

Accept when prompted.

Try to execute again

Please mark as "Accept the answer" if the above steps helps you. Others with similar issues can also follow the solution as per your suggestion

Regards,

Manu

0 Votes 0 · ·

I appreciate the answer but it did not work

0 Votes 0 · ·

When I tried to make a python 3.8 virtual environment (which is my default python version) it gave a similar error (I don't remember the error but it is related to permissions only).
i ran

 Set-ExecutionPolicy Unrestricted -Force

to rectify the error and it worked, but now when I wanted to specify a particular python version using a path it is giving me an error

 virtualenv --python="C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Python 3.7" "p37\env1"
 RuntimeError: failed to query C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Python 3.7 with code 13 err: 'Access is denied'

Hope this gives some context

0 Votes 0 · ·
Show more comments