0

I'm following the tutorial for creating a microblog using the Flask from the Miguel Grinberg website. The link is as following:

https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-i-hello-world

After creating the microblog folder and entering inside, I created the virtualenv using the command virtualenv flask. This creates a flask folder inside the `microblog'. However, after I can't execute any of the following commands, say:

flask/bin/pip install flask

It will return the error:

bash: flask/bin/pip: "/Users/Chaklader/Documents/Online: bad interpreter: No such file or directory`. 

Should I enter the flask/bin folder and execute the commands ?

Note: I haven't activated the virtual environment using the command: source flask/bin/activate as suggested. I use Mac OS for working.

Here is the screenshot which is requested in the comment and it still returns error:

enter image description here

Chaklader
  • 159
  • 1
  • 2
  • 16
  • Why haven't you activated the virtualenv? Isn't that how one is supposed to use the pip inside the virtualenv? – Aditya Nov 18 '16 at 05:01
  • It was suggested not to activate the virtualenv. However, I activated and it still doesn't work – Chaklader Nov 18 '16 at 05:05
  • 1
    These might help: http://stackoverflow.com/questions/31768128/pip-installation-usr-local-opt-python-bin-python2-7-bad-interpreter-no-such-f or http://stackoverflow.com/questions/7911003/cant-install-via-pip-with-virtualenv – Aditya Nov 18 '16 at 05:09
  • What's your error when you activated the virtualenv? – dvnguyen Nov 18 '16 at 05:19
  • I still get the same error after activating the virtualenv – Chaklader Nov 18 '16 at 05:21
  • 1
    try renaming your enviromnement something other than "flask" this is quite likely to cause a clash with the module "flask" you're trying to install. – maxymoo Nov 18 '16 at 05:22
  • Still the same error here. Interesting issue – Chaklader Nov 18 '16 at 05:32
  • Did you get any error when activating the virtualenv? If not, just run `pip install flask`. – dvnguyen Nov 18 '16 at 05:38
  • There was no error and I just ran the command `pip install flask` than `flask/bin/pip install flask` and still gets the same error. On the other hand, when I just open a new terminal and run `pip install flask` it shows the requirement already satisfied. – Chaklader Nov 18 '16 at 05:39
  • Can you try three following steps: 1. `virtualenv venv`, 2. `source venv/bin/activate`, 3. `pip install flask`. If there's any error, could you paste the entire shell screen output from the step 1? – dvnguyen Nov 18 '16 at 05:45
  • @dvnguyen Yes and the error is posted as the screenshot inside the question. – Chaklader Nov 18 '16 at 05:49
  • Your whole filepath has **spaces**. The comment with the links above is correct – OneCricketeer Nov 18 '16 at 05:53
  • Thanks. Another guess is the white space in directory names might be the problem. Could you try it again in another working directory that doesn't have white space in its path. For example: `~/flasktutorial`. – dvnguyen Nov 18 '16 at 05:55
  • Yes, that is the case. After I changed the folder name to without space, the whole issue is solved. – Chaklader Nov 18 '16 at 06:43

0 Answers0