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 January 25, 2021 by proseller
1 Asked on January 25, 2021 by ineedhelp
1 Asked on January 25, 2021 by allison-mueller
2 Asked on January 25, 2021 by sudhishkr
1 Asked on January 25, 2021 by temp_user
1 Asked on January 24, 2021 by aormsby
0 Asked on January 24, 2021 by johnson
0 Asked on January 24, 2021 by mzafer
1 Asked on January 24, 2021 by musaab
1 Asked on January 24, 2021 by faisal-budiman
1 Asked on January 24, 2021 by watyf
1 Asked on January 24, 2021 by sawan
3 Asked on January 24, 2021 by leos-literak
1 Asked on January 24, 2021 by shekar
2 Asked on January 24, 2021
automapper blazor c dependency injection nullreferenceexception
2 Asked on January 24, 2021 by niall-parker
Get help from others!
Recent Answers
Recent Questions
© 2023 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP