problem in activating virtual environment in Django with ". \Scripts\activate" command

5,659 views
Skip to first unread message

Django Geek Aditya

unread,
Jan 17, 2019, 2:18:35 PM1/17/19
to Django users
Shell Output after entering command is
PS E:\todo> . \Scripts\activate
. : The term '\Scripts\activate' is not recognized as the name of a cmdlet, function, script file, or operable
program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:3
+ . \Scripts\activate
+   ~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (\Scripts\activate:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

PS E:\todo>

Danylo K.

unread,
Jan 17, 2019, 2:21:32 PM1/17/19
to django...@googlegroups.com
try .\scripts\activate.bat                                                                                    

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/00a2f79a-0d62-4fd8-8cd4-cd5b9e8d1f2b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jorge Gimeno

unread,
Jan 17, 2019, 2:22:52 PM1/17/19
to django...@googlegroups.com
I assume that's in Windows Powershell. I think it's .\Scripts\activate.bat

I would also check to ensure that the Scripts folder exists in your current directory.

-Jorge

Lutalo Bbosa joseph

unread,
Jan 17, 2019, 2:59:06 PM1/17/19
to django...@googlegroups.com
if linux, then activating the env is source/bin/activate
after changing to that directory

shiva kumar

unread,
Jan 17, 2019, 10:09:08 PM1/17/19
to django...@googlegroups.com
Can you tell which os ur using.

SATYA PRAKASH BHARTI

unread,
Jan 17, 2019, 11:05:24 PM1/17/19
to Django users
Use this command this worked for me. ----    Set-ExecutionPolicy Unrestricted

Phước Thịnh Nguyễn

unread,
Jan 17, 2019, 11:05:24 PM1/17/19
to Django users
In Windows, you can active by 'cmd' :D

Vào 02:18:35 UTC+7 Thứ Sáu, ngày 18 tháng 1 năm 2019, Django Geek Aditya đã viết:

Django Geek Aditya

unread,
Jan 18, 2019, 7:46:03 AM1/18/19
to Django users
.\scripts\activate.bat is also not working
THE SHELL OUTPUT IS -> 
PS E:\todo> .\Scripts\activate.bat
.\Scripts\activate.bat : The term '.\Scripts\activate.bat' is not recognized as the name of a cmdlet, function, script
file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct
and try again.
At line:1 char:1
+ .\Scripts\activate.bat
+ ~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (.\Scripts\activate.bat:String) [], CommandNotFoundException

Django Geek Aditya

unread,
Jan 18, 2019, 7:46:03 AM1/18/19
to Django users
I'm using Windows 10

Michal Petrucha

unread,
Jan 18, 2019, 8:06:30 AM1/18/19
to Django users
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
Hi Aditya,

The correct incantation for Powershell is

.\Scripts\activate.ps1

The version without any extension, or with .bat, would be correct if
you were running standard Windows cmd instead.

Good luck,

Michal
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAEBCgAGBQJcQc8bAAoJEHA7T/IPM/kl/UwQAOW6VmD4ziMlE0iCWI6cebb5
omFIvG7cR5vT68RyONUiIJVhxOlGhEdkNTvrKsok7Kztp7ncOyK+b5WQgcDe32DS
bl6kJxXSNNSQOfE3KdprOn/5wOYtwdSHH8JNe4R6n/um7kVetjUbnkfraHoFBS5R
J0gKdpBkWEOEjoV/jJThzytvPjE0TgatcYthGLd8lrmAA9QQgIRguYNo+aRvFXv6
2n9uufi3wWLkA8Bv96qADa6vBgSBP6dtBKY3u73M/3U44q/OJO4LAbwYqqsVy032
Y2IGlTozqpFrSuu7yXH4DpCxy3o/WS20NFpmFYyQ9zlQbtldxfbLLQi/PWhi/xfm
bpwvG+InT0LvbYZsroaWBb9BX44ZkaDZMf4b6dVF7r1Unf/Win8YImK+mWxWu+iT
qMpIGAFGeawGuYYACkdw1DdgF7yqyiGYuDcCHCO6TyYVki5jW1nNHQV9Qyp8rcv9
SzH49ftAqn7PX+lXqrOke8G7+/2DMRSexVZoK3cTNMpeCkqwBrkghaBfr5vMGasI
4qNdWuzLiGkFv1lQWmb5Sm9e9eNAy0uFnTSzhsePT1J4Vs9tcr5y0A3/VY2dD8uv
gTZPj/lXcVTj4OetRRzjClhNiEqBAG3ji6wCIZ3yYlss+kHRX9q7Hm8dw7nROP6y
mnJHMuNJZVgxoiywqOX7
=pAUo
-----END PGP SIGNATURE-----

official...@gmail.com

unread,
Jan 18, 2019, 9:46:41 AM1/18/19
to Django users
I had the same issue today, but i was able to fix it. I use windows 10 too. Kindly follow this guide to setup your virtualenv:

Step One: This is really important to do because i really don't know what is the major cause of this errors but what i discovered in my time is the installation right from the start of python itself needs to be properly done. So do this uninstall everything that has to do with python, anaconda, any python version you have, pycharm and all the likes, also go to your path variable and remove any path that show python.

Step Two: Goto https://www.python.org/downloads/ and download V3.7.2 the latest version currently on python official website

Step 3: After download, launch the installer ensure you select Add Python 3.6 to PATH, secondly choose customize ensure all is selected hit next

Step 4: Ensure you select the following 
  • Install for all users
  • Add Python to environment variables
  • Create shortcuts for installed applications
  • Recompile standard library or whatever this one is
Then hit install
Step 5: once installation is completed, launch your powershell or cmd as admin and type python -V and hit enter. It should output Python 3.7.2

Step 6: Ensure your powershell is run as admin then run this command Set-ExecutionPolicy Unrestricted, follow the instructions and select choose Y to update your powershell
Step 7: Follow this code:
cd ~/
mkdir Env
pip install virtualenv
pip freeze (to verify -- output will be virtualenv==version number)
cd ~/Env
mkdir environment
cd environment
virtualenv .
cd ~\Env\environment
.\Scripts\activate

Gotten here nice work! just try pip freeze (would not returning anything at this point, this confirm your virtualevn is working fine.)
Having Challenge installing django, hola me

Matthew Pava

unread,
Jan 18, 2019, 10:54:14 AM1/18/19
to django...@googlegroups.com

I would switch over to pipenv and leave the details to that.

--

You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.

Kuber Sodari

unread,
Jan 18, 2019, 11:12:53 AM1/18/19
to Django users
Okay, I see your problem is that you are doing it the wrong way.
Go to the path where you have your virtual environment folder such as 
cd C:\Python_project\project_name\
if we suppose I have a virtual environment with a directory as 'venv' created inside my project directory 'project_name' and then to activate this virtual environment, I would do
venv\Scripts\activate [ENTER]
Doing this should resolve your problem

regtech

unread,
Jan 18, 2019, 11:51:07 AM1/18/19
to django-users
Hello, I wanna get the list of Classes and other definitions in a python file,
I tried :
dir( __package__ )
it returns some string,
but not get what i needing.
Some help me?
Thank u!

hadi tedi

unread,
Jan 18, 2019, 12:38:52 PM1/18/19
to Django users
I had similar problem before.

try 
"cd " until you reach the directory of "scripts" then type "activate".
same thing to deactivate.

 Hadi
Reply all
Reply to author
Forward
0 new messages