최신 버전의 Python을 사용하기 위해`venv '로 Python 가상 환경을 업데이트하려면 어떻게해야합니까?

LightCC

최근에 Python 3.7.4와 함께 Python 3.8.0을 설치했습니다.

가상 환경 ( python -m venv <directory>v3.7.4 기반을 사용하여 생성 했습니다. v3.8.0을 사용하도록 업데이트하려면 어떻게해야합니까?

새 가상 환경을 만들고 종속성, 스크립트 등을 다시 설치해야합니까?


참고 : 이전 패키지 / 도구 를 다루는 기존 Q & A ( 예 :이 )가 virtualenv있습니다. 저는 특히 venvv3.3부터 Python에 표준 내장 된 새로운 내장 모듈 에 대해 묻고 있으며 virtualenv.

RMPR

나는 당신이 찾고있는 것이 --upgrade매개 변수 라고 생각합니다 .

python -m venv --help
usage: venv [-h] [--system-site-packages] [--symlinks | --copies] [--clear]
            [--upgrade] [--without-pip] [--prompt PROMPT]
            ENV_DIR [ENV_DIR ...]

Creates virtual Python environments in one or more target directories.

positional arguments:
  ENV_DIR               A directory to create the environment in.

optional arguments:
  -h, --help            show this help message and exit
  --system-site-packages
                        Give the virtual environment access to the system
                        site-packages dir.
  --symlinks            Try to use symlinks rather than copies, when symlinks
                        are not the default for the platform.
  --copies              Try to use copies rather than symlinks, even when
                        symlinks are the default for the platform.
  --clear               Delete the contents of the environment directory if it
                        already exists, before environment creation.
  --upgrade             Upgrade the environment directory to use this version
                        of Python, assuming Python has been upgraded in-place.
  --without-pip         Skips installing or upgrading pip in the virtual
                        environment (pip is bootstrapped by default)
  --prompt PROMPT       Provides an alternative prompt prefix for this
                        environment.

대상 Python 버전으로 실행해야합니다. 예를 들면 다음과 같습니다.

python3.8 -m venv --upgrade <path_to_dir>

python3.8이 python 3.8.0 실행 파일의 이름이라고 가정합니다.

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

Related 관련 기사

뜨겁다태그

보관