My PowerShell virtual environment activates the virtual environment for my Django project but does not show the parenthesis does it really matter. C:\Users\xxx\.virtualenvs\mb-g7VMb0x7 already activated
. I cannot use Scripts\activate
as I installed my virtualenv using pipenv
not virtualenv -p python .
which normal carry the scripts folder. On my Vscode the parenthesis shows that I am in a virtual environment (mb) PS E:\Dev\mb
.
Asked
Active
Viewed 316 times
-1

coja56
- 25
- 5
-
Just to clarify: You're asking if the absence of a prefix such as `(mb)` _from the PowerShell prompt string_ indicates a problem? – mklement0 Jul 16 '21 at 14:46
-
It doesn't indicate a problem because when I run ```sys.executable``` its shows I am in a virtual environment. I simply wanted to know how to activate the prefix – coja56 Jul 18 '21 at 09:23
-
1It would really help if you could rewrite your post and its title to clearly state your question. Read https://stackoverflow.com/help/how-to-ask for tips. – Marlon Richert Jul 18 '21 at 11:33
2 Answers
0
It works well on my computer, could you provide a screenshot of it?
pipenv
environment has a Script
folder that contains activate function, such as
& C:/Users/Administrator/.virtualenvs/Administrator-S9WHhKuh/Scripts/Activate.ps1
in the following picture:
Update:

Steven-MSFT
- 7,438
- 1
- 5
- 13
-
I am still a below points to be allowed to put a screen shot but I have loaded the outcome – coja56 Jul 19 '21 at 09:58
0
How do I activate in my PowerShell or Bash terminals the prefix to show. I am in a virtual environment if I run sys.python
it will show I am in a virtual environment.
xxx@DESKTOP-TL9TTEG MINGW64 /e/works/mslearn-django-views-templates/starter (main)
$ python
Python 3.8.5 (tags/v3.8.5:580fbb0, Jul 20 2020, 15:43:08) [MSC v.1926 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> print(sys.executable)
C:\Users\xxx\.virtualenvs\starter-Nf07b0Gm\Scripts\python.exe
>>> exit()
xxx@DESKTOP-TL9TTEG MINGW64 /e/works/mslearn-django-views-templates/starter (main)
Whereas in my Vscode editor the prefix shows that I am in a virtual environment.
PS E:\works\mslearn-django-views-templates\starter> & C:/Users/xxx/.virtualenvs/starter-Nf07b0Gm/Scripts/Activate.ps1
(starter) PS E:\works\mslearn-django-views-templates\starter>
Will this affect the final output of my project

coja56
- 25
- 5
-
hi, sorry for late, it works well on my computer, you can check the update in my answer. If you directly run & C:/Users/xxx/.virtualenvs/starter-Nf07b0Gm/Scripts/Activate.ps1 in your PowerShell, what will happen? Have you add the python path of the virtual environment in your environment path? You can get your environment path through this command in your powershell: $env:path – Steven-MSFT Jul 20 '21 at 06:25