Reputation: 145
When you run pipenv shell on VS Code powershell the virtualenv id does not show like
(virtualenv_name-JSHDF90KJH0)c:\
only shows
c:\
how do you setup powershell to show the virtualenv id or name in Windows 10?
Upvotes: 1
Views: 2148
Reputation: 189
If you move to the Scripts folder you will find Activate.ps1
:
Directory: D:\....\project_env\Scripts
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 19-Jul-21 1:23 PM 2030 activate
-a---- 19-Jul-21 1:23 PM 1022 activate.bat
-a---- 19-Jul-21 1:23 PM 19328 Activate.ps1
-a---- 19-Jul-21 1:23 PM 368 deactivate.bat
-a---- 19-Jul-21 1:23 PM 106417 easy_install-3.9.exe
-a---- 19-Jul-21 1:23 PM 106417 easy_install.exe
-a---- 19-Jul-21 1:23 PM 106408 pip.exe
-a---- 19-Jul-21 1:23 PM 106408 pip3.9.exe
-a---- 19-Jul-21 1:23 PM 106408 pip3.exe
-a---- 19-Jul-21 1:23 PM 537264 python.exe
-a---- 19-Jul-21 1:23 PM 535728 pythonw.exe
Run it to activate the environment in powershell...
Upvotes: 3
Reputation: 29
Once you pipenv install
your project and ran virtualenv -p python3 .
, you can run inside your project's folder the command
.\Scripts\activate
this will activate the virtual environment with the parentheses marks, indicating the name of which virtual environment is running:
(myproject) PS C:\Users\me\Dev\myproject>
This solution, however, won't show you the virtual environment ID, only it's name.
Upvotes: 0
Reputation: 73
Well, I had a similar problem using venv, so I'll post what I did in my case.
I was using python -m venv /app_env
or app_env
/ and when I activated the enviroment, the name of the enviroment (app_env)
wasn't showing.
But when I did
python -m venv app_env
And activated, It worked:
(budget_app_env) PS C:\Users\some_user\project\app_project>
So maybe you had a problem with "/"s.
And by the way, python doc recommends using venv because pyenv was deprecated.
Upvotes: 0