Issue
I have activated git bash
instead of command prompt
(cmd) in Pycharm. Whenever I try to activate the virtualenv, which is named venv
, I face with two problems:
- After I execute
source venv/Scripts/activate
, face with the following error:
bash: basename: command not found
()
which (I think) means that it doesn't recognize source
command.
- Running
./venv/Scripts/activate
has also another problem:
You must source this script: $ source ./venv/Scripts/activate
()
What should I do?
PS: Also <exact-directory>/venv/Scripts/activate
works properly in cmd.
Solution
There is a python package called pipenv
.
It can be installed easily by entering pip install pipenv
command. Then start using it by executing the following command:
pipenv shell
It automatically creates a new virtual environment.
Freezing the packages is as simple as:
pipenv lock -r > requirements.txt
Answered By - Mostafa Ghadimi