ys d
ys d

Reputation: 93

can't enable the Python virtual environment while creating an app on Mac

I am following instruction to create Mac app with Python. I was installing Virtualenv as a part of it, as here says. I successfully did till second step; pip install, bash_profile. But when I try to Enable the virtual environment part, I get a. no file or directory / b&c. command not found, for each step.

By the way, this is the first time I heard .bash_profile, so the script is empty except what I did at the second step.

How can I fix the problem?

Upvotes: 3

Views: 7492

Answers (2)

Muhammad Usman
Muhammad Usman

Reputation: 10946

Follow simple steps

  1. pip install virtualenv
  2. virtualenv <venv name>
  3. source venv/bin/activate

another way of creating a venv in python 3 only

  1. python -m venv <venv name>
  2. source venv/bin/activate

Upvotes: 7

McGrady
McGrady

Reputation: 11487

I suggest you read Virtualenv User Guide.

  1. Install virtualenv by using pip install virtualenv

  2. virtualenv ENV to create virtual environment.

    Where ENV is a directory to place the new virtual environment.

  3. source bin/activate to activate script.

  4. And type deactivate to undo the changes.

virtualenvwrapper

Add three lines to your shell startup file (.bashrc, .profile, etc.) to set the location where the virtual environments should live, the location of your development project directories, and the location of the script installed with this package:

export WORKON_HOME=$HOME/.virtualenvs
export PROJECT_HOME=$HOME/Devel
source /usr/local/bin/virtualenvwrapper.sh

Run source ~/.bashrc to reload the startup file.

Upvotes: 1

Related Questions