0
votes

I'm trying to learn Flask at the moment by following this tutorial , but I'm having trouble at the first part where I need to install virtualenv. Here are the steps that I have taken and the results:

  1. Edited my PATH to include D:\Program Files\Python3 and D:\Program Files\Python3\Scripts
  2. Opened Command Prompt (running it as administrator)
  3. Navigated to the directory I want to create my project in
  4. Typed python -m venv flask and a folder containing flask was created
  5. Typed pip install virtualenv and here's where the error arose:

Traceback (most recent call last):

File "D:\Program Files\Python3\lib\runpy.py", line 170, in _run_module_as_main "__main__", mod_spec)

File "D:\Program Files\Python3\lib\runpy.py", line 85, in _run_code exec(code, run_globals)

File "D:\Program Files\Python3\Scripts\pip.exe__main__.py", line 5, in

ImportError: No module named 'pip'

That seems odd to me, as the path is accurate. I even confirmed this by typing echo %PATH% and got these results:

C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client\;C: \Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\Syst em32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Int el(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Man agement Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Component s\IPT;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x 86)\Skype\Phone\;D:\Program Files\Python3;D:\Program Files\Python3\Scripts

I'm running Python 3.4.3

As you can see by this screenshot, my PATH should be correct:

location of pip

1
While this doesn't address your PATH issue, step 5 is unnecessary. venv creates your virtual environment. You don't need to use virtualenv to do that. - dirn
Thanks for the tip. I have no idea, I was just following the tutorial. - Taylor Liss
The tutorial says you only need to install it for versions of Python prior to 3.4. - dirn
Oh dang, you're right. Sorry I read the instructions wrong! - Taylor Liss
Right. And that's step 4. Step 5 says "If you are using any other version of Python older than 3.4, then you need to download and install virtualenv.py before you can create a virtual environment." - dirn

1 Answers

0
votes

Figured it out:

For some reason, pip install virtualenv won't work if Python is installed on a drive that is not the C:/ drive. I reinstalled Python to c:/Python34 and tried pip install virtualenv again (after changing the PATH) and it worked fine.