Study

Virtualenv(venv) 로 python 다른 버젼 가상환경 설정

whistory 2023. 1. 11. 09:23
반응형

 

 

python 3.6 버전의 패키지가 필요하다.

 

하지만 로컬 pc에 설치되어 사용중인 python은 3.9이다.

바로 venv를 실행하면, 3.9버전으로 생성이된다.

PS C:\workspace\api> python --version
Python 3.9.10
PS C:\workspace\api> mkdir setup  

    디렉터리: C:\workspace\api

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d-----      2022-12-09   오후 1:58                setup

PS C:\workspace\api> python -m venv .venv
PS C:\workspace\api> .\.venv\Scripts\activate
(.venv) PS C:\workspace\api> python  --version
Python 3.9.10
(.venv) PS C:\workspace\api>

 

 

 

나는 3.6버전이 필요하다.

 

버전을 명시하고 venv 생성을 시도하는데,

내 pc에는 3.6이 깔려있지 않다.

PS C:\workspace\api\setup36> py -3.6 -m venv .venv
Python 3.6 not found!
Installed Pythons found by C:\WINDOWS\py.exe Launcher for Windows
 -3.9-64 *
 -3.8-64

Requested Python version (3.6) not installed, use -0 for available pythons
PS C:\workspace\api\setup36>

 

 

내 로컬 pc에 python 3.6을 설치하고,

 

버전명시 후 venv 생성을 시도한다.

성공.

PS C:\workspace\api\setup36> py -3.6 -m venv .venv
PS C:\workspace\api\setup36>  .\.venv\Scripts\activate
(.venv) PS C:\workspace\api\setup36> python --version
Python 3.6.6
(.venv) PS C:\workspace\api\setup36>

 

 

이제 venv 환경에서 필요한 python 3.6 모듈을 egg로 말아본다.

(.venv) PS C:\workspace\api\setup36> python .\setup.py develop
running develop
C:\workspace\api\setup36\.venv\lib\site-packages\setuptools\command\easy_install.py:159: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
  EasyInstallDeprecationWarning,
C:\workspace\api\setup36\.venv\lib\site-packages\setuptools\command\install.py:37: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
  setuptools.SetuptoolsDeprecationWarning,
running egg_info
writing kosis_module.egg-info\PKG-INFO
writing dependency_links to kosis_module.egg-info\dependency_links.txt
writing requirements to kosis_module.egg-info\requires.txt
writing top-level names to kosis_module.egg-info\top_level.txt
package init file 'kosis_module\__init__.py' not found (or not a regular file)
reading manifest file 'kosis_module.egg-info\SOURCES.txt'
writing manifest file 'kosis_module.egg-info\SOURCES.txt'
running build_ext
Creating c:\workspace\api\setup36\.venv\lib\site-packages\kosis-module.egg-link (link to .)
kosis-module 0.1 is already the active version in easy-install.pth

Installed c:\workspace\api\setup36
Processing dependencies for kosis-module==0.1
Searching for pyarrow==6.0.1
Best match: pyarrow 6.0.1
Adding pyarrow 6.0.1 to easy-install.pth file
Installing plasma_store-script.py script to C:\workspace\api\setup36\.venv\Scripts
Installing plasma_store.exe script to C:\workspace\api\setup36\.venv\Scripts

Using c:\workspace\api\setup36\.venv\lib\site-packages
Searching for numpy==1.19.5
Best match: numpy 1.19.5
Adding numpy 1.19.5 to easy-install.pth file
Installing f2py-script.py script to C:\workspace\api\setup36\.venv\Scripts
Installing f2py.exe script to C:\workspace\api\setup36\.venv\Scripts

Using c:\workspace\api\setup36\.venv\lib\site-packages
Finished processing dependencies for kosis-module==0.1
(.venv) PS C:\workspace\api\setup36>
(.venv) PS C:\workspace\api\setup36> python setup.py bdist_egg
running bdist_egg
running egg_info
writing kosis_module.egg-info\PKG-INFO
writing dependency_links to kosis_module.egg-info\dependency_links.txt
writing requirements to kosis_module.egg-info\requires.txt
writing top-level names to kosis_module.egg-info\top_level.txt
package init file 'kosis_module\__init__.py' not found (or not a regular file)
reading manifest file 'kosis_module.egg-info\SOURCES.txt'
writing manifest file 'kosis_module.egg-info\SOURCES.txt'
installing library code to build\bdist.win-amd64\egg
C:\workspace\api\setup36\.venv\lib\site-packages\setuptools\command\install.py:37: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
  setuptools.SetuptoolsDeprecationWarning,
running install_lib
running build_py
warning: install_lib: 'build\lib' does not exist -- no Python modules to install

creating build
creating build\bdist.win-amd64
creating build\bdist.win-amd64\egg
creating build\bdist.win-amd64\egg\EGG-INFO
copying kosis_module.egg-info\PKG-INFO -> build\bdist.win-amd64\egg\EGG-INFO
copying kosis_module.egg-info\SOURCES.txt -> build\bdist.win-amd64\egg\EGG-INFO
copying kosis_module.egg-info\dependency_links.txt -> build\bdist.win-amd64\egg\EGG-INFO
copying kosis_module.egg-info\requires.txt -> build\bdist.win-amd64\egg\EGG-INFO
copying kosis_module.egg-info\top_level.txt -> build\bdist.win-amd64\egg\EGG-INFO
zip_safe flag not set; analyzing archive contents...
creating dist
creating 'dist\kosis_module-0.1-py3.6.egg' and adding 'build\bdist.win-amd64\egg' to it
removing 'build\bdist.win-amd64\egg' (and everything under it)
(.venv) PS C:\workspace\api\setup36>
반응형