티스토리 뷰
Stack Overflow에 자주 검색, 등록되는 문제들과 제가 개발 중 찾아 본 문제들 중에서 나중에도 찾아 볼 것 같은 문제들을 정리하고 있습니다.
Stack Overflow에서 가장 먼저 확인하게 되는 가장 높은 점수를 받은 Solution과 현 시점에 도움이 될 수 있는 가장 최근에 업데이트(최소 점수 확보)된 Solution을 각각 정리하였습니다.
아래 word cloud를 통해 이번 포스팅의 주요 키워드를 미리 확인하세요.
How to leave/exit/deactivate a Python virtualenv
Python 가상환경에서 나가는/종료하는 방법
문제 내용
I'm using virtualenv and the virtualenvwrapper. I can switch between virtualenv's just fine using the workon
command.
저는 virtualenv와 virtualenvwrapper를 사용하고 있습니다. workon 명령어를 사용하여 가상환경 간에 쉽게 전환할 수 있습니다.
me@mymachine:~$ workon env1
(env1)me@mymachine:~$ workon env2
(env2)me@mymachine:~$ workon env1
(env1)me@mymachine:~$
How do I exit all virtual environments and work on my system environment again? Right now, the only way I have of getting back to me@mymachine:~$
is to exit the shell and start a new one. That's kind of annoying. Is there a command to work on "nothing", and if so, what is it? If such a command does not exist, how would I go about creating it?
모든 가상환경을 빠져나와 시스템 환경에서 작업하려면 어떻게 해야 하나요? 현재, 셸에서 me@mymachine:~$ 로 돌아가는 유일한 방법은 셸을 종료하고 새로 시작하는 것입니다. 이것은 좀 귀찮은 일입니다. "아무것도"에 대해 작업하는 명령어가 있는지, 있다면 무엇인지 알려주세요. 이러한 명령어가 없다면, 어떻게 만들 수 있을까요?
높은 점수를 받은 Solution
Usually, activating a virtualenv gives you a shell function named:
일반적으로 가상 환경을 활성화하면 다음과 같은 이름의 셸 함수가 생성됩니다.
$ deactivate
which puts things back to normal.
그 셸 함수는 일반적으로 모든 것을 다시 정상 상태로 돌려놓습니다.
I have just looked specifically again at the code for virtualenvwrapper
, and, yes, it too supports deactivate
as the way to escape from all virtualenvs.
저는 방금 virtualenvwrapper 코드를 다시 구체적으로 살펴봤는데, 그렇습니다. deactivate 명령어를 사용하여 모든 가상 환경에서 빠져나오는 방법을 지원합니다.
If you are trying to leave an Anaconda environment, the command depends upon your version of conda
. Recent versions (like 4.6) install a conda
function directly in your shell, in which case you run:
Anaconda 환경에서 나오려는 경우, 명령어는 conda의 버전에 따라 다릅니다. 최근 버전(예: 4.6)은 쉘에 직접 conda 함수를 설치하므로 다음과 같이 실행합니다:
conda deactivate
Older conda versions instead implement deactivation using a stand-alone script:
과거 버전의 conda는 대신 스탠드얼론 스크립트를 사용하여 비활성화를 구현합니다.
source deactivate
가장 최근 달린 Solution
$ conda deactivate
or$ source deactivate
would work.
If it doesn't work, try deactivate [name of your environment]
instead.
$ conda deactivate 또는 $ source deactivate 를 실행하면 됩니다.
작동하지 않는 경우 대신 deactivate [당신의 환경 이름] 을 시도해보세요.
출처 : https://stackoverflow.com/questions/990754/how-to-leave-exit-deactivate-a-python-virtualenv
'개발 > 파이썬' 카테고리의 다른 글
객체가 리스트 또는 튜플인지 확인하는 방법 (0) | 2023.03.09 |
---|---|
여러 리스트의 가능한 모든 조합 구하기 (0) | 2023.03.09 |
Youtube_dl : 오류 수정하기 (0) | 2023.03.07 |
딕셔너리 리스트에서 특정 키의 값 리스트로 가져오기 (0) | 2023.03.07 |
상위 디렉토리에서 파일을 가져오는 방법 (0) | 2023.03.06 |