Stack Overflow Asked by Mostafa Ghadimi on January 1, 2022
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:
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.
./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.
just write this command line in your virtual environment file:
. Scripts/activate
Answered by zeki kadiroğlu on January 1, 2022
The correct answer appears to be in the comment added by @Touten.
This is actually just a display issue - the venv is activated, but it doesn't display the usual (venv) tag in the terminal. This can be confirmed by calling which python
and seeing that is displays the venv's python.
Alternatively, you can follow the answer by @Nikki-Aaron to disable automatically activating the venv. Then you can activate it using source venv/Scripts/activate
and it will show the tag in the terminal.
Answered by Further Reading on January 1, 2022
There is a setting in File > Settings > Terminal for "Activate virtualenv". This works for cmd shell, but seems not to work with bash in Windows 10. If I uncheck that setting, 'source venv/Scripts/activate' activates as expected.
Answered by Nikki on January 1, 2022
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 on January 1, 2022
2 Asked on October 23, 2020 by maxbre
2 Asked on October 23, 2020 by chase-alder
chrome native messaging google chrome extension javascript messaging
0 Asked on October 23, 2020 by c-likethis123
0 Asked on October 22, 2020 by mozadded
1 Asked on October 22, 2020 by danahi
2 Asked on October 21, 2020 by nasenbaer
2 Asked on October 21, 2020 by ven-nilson
1 Asked on October 19, 2020 by junaka
2 Asked on October 19, 2020 by bruce-shen
1 Asked on October 18, 2020 by thorsten-schroeer
1 Asked on October 16, 2020 by rama
6 Asked on October 16, 2020 by m-fatih
2 Asked on October 16, 2020 by dani
3 Asked on October 16, 2020 by orematasaburo
2 Asked on October 16, 2020 by arif
3 Asked on October 15, 2020 by natalia-davydova
1 Asked on October 14, 2020 by asad-iqbal
Get help from others!
Recent Questions
Recent Answers
© 2023 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP, SolveDir