![]() |
Activate Virtual Environment and Help to get started with Python - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Activate Virtual Environment and Help to get started with Python (/thread-1950.html) |
Activate Virtual Environment and Help to get started with Python - Adelton - Feb-06-2017 Hi There, I am new to Python and programming.I am very interested in learning to code in particular with regards to web development using python.I have installed python 3.6 and also virtual environment(python -m Venv) in my User folder.I am trying to activate it and I am following instructions which I found online which recommends I use the following command in the command prompt C:\><venv>Scripts\activate.bat but it does not work when I enter it. I have tried to enter this using my user folder where virtual environment is installed because I can see the activate file in the scripts folder and when I do I do not get any error message.I just get referred back to my scripts folder.I would really appreciate your help in figuring out how to activate virtual environment and how to check it has been installed. I would also really value any advice with regards to learning python like a Professional.I am currently reading multiples books on python such as Learn Python the hard way by Fabrizio Romano and Learn Python by Mark Lutz.I apologize if this message seems mundane to my fellow members of this forum Thank you Adelton RE: Activate Virtual Environment and Help to get started with Python - ruggierom - Feb-06-2017 Adelton, I am not a professional python dev however I do php professionally, as well as other non-dev things. I also don't use Windows so I can't help much there, but I will suggest this: * Find step-by-step tutorials which start from the installation of Python and continue on to setting up a Virtual Environment. * I found this page here: https://virtualenv.pypa.io/en/stable/userguide/#windows-notes which explains some notes about Windows, specifically needing win32api. * Open the activate.bat using notepad and review the paths, there may be a path issue It would also help if you copy/paste what is happening from your command prompt. You can click on the top right of the window (this is based on memory) and there should be something similar to "mark" or "select" which will allow you to copy the info into your buffer, then you can paste here using the proper code bbcode tags. If you take us step-by-step what you are doing you are more likely to get some help. Best of luck RE: Activate Virtual Environment and Help to get started with Python - snippsat - Feb-06-2017 Quote:* Find step-by-step tutorials which start from the installation of Python and continue on to setting up a Virtual Environment.In 3.6 virtual environment is build in, no need for win32api or install the 3-party virtualenv that you link to. Here is a run with explanation. I use cmder it work the same in cmd(but which python don't work).You are right in Windows you give path to activate.bat ,in Linux there is a own command source venv/bin/activate C:\ # Make virtual enviroment # Python 3.6 is set in Environment Variables Path(3.6 dos this for you under installtion) λ python -m venv my_env # cd into the folder C:\ λ cd my_env # Now activate bye given path to bat file C:\my_env λ C:\my_env\Scripts\activate.bat # Now is folder active,you see (my_env) (my_env) C:\my_env # With cmder i can check that right python is used λ which python /c/my_env/Scripts/python # Test install into virtual environment (my_env) C:\my_env λ pip install requests Collecting requests Downloading requests-2.13.0-py2.py3-none-any.whl (584kB) 100% |████████████████████████████████| 593kB 1.4MB/s Installing collected packages: requests Successfully installed requests-2.13.0 # Load Python and check Requests (my_env) C:\my_env λ python Python 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 07:18:10) [MSC v.1900 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import requests >>> requests.__version__ '2.13.0' >>> exit() # Freeze version info (my_env) C:\my_env λ pip freeze > requirements.txt # Read requirements.txt (my_env) C:\my_env λ more requirements.txt requests==2.13.0 RE: Activate Virtual Environment and Help to get started with Python - Adelton - Feb-14-2017 I would like to thank you both for your insightful solutions to resolving this mundane problem because I have managed to activate the activate.bat file in the command line. RE: Activate Virtual Environment and Help to get started with Python - Larz60+ - Feb-14-2017 Quote:Snippsat wrote: When Snippsat mentioned cmder to me, I installed it immediately. I will vouch for the app. I don't even think about Windows 'cmd' anymore, I automatically right click and use cmder. Now I use grep in windows the same as I would on Linux. |