python virtualenvwrapper

◾️ environment set in Mac

https://virtualenvwrapper.readthedocs.io/en/latest/

$ which python3
/Library/Frameworks/Python.framework/Versions/3.9/bin/python3

$ pip3 install virtualenv virtualenvwrapper
...

$ which virtualenvwrapper.sh
/Library/Frameworks/Python.framework/Versions/3.9/bin/virtualenvwrapper.sh

$ vi .bash_profile
...
# python3 virtualenvwrapper env
export WORKON_HOME=~/virtualEnv
export VIRTUALENVWRAPPER_PYTHON=/Library/Frameworks/Python.framework/Versions/3.9/bin/python3

(save and new terminal)

$ source /Library/Frameworks/Python.framework/Versions/3.9/bin/virtualenvwrapper.sh
...
(useful command for virtualenvwrapper)
$ mkvirtualenv [vitual-env-name]
$ rmvirtualenv [vitual-env-name]
$ workon [vitual-env-name]
$ setvirtualenvproject
$ cdproject
$ deactivate

◾️ example : pip install xxx after workon status(virtualenv)

$ cd ~/Document/workdir
$ mkvirtualenv corona
$ workon corona
(corona) $ pip3 install jupyterlab
(corona) $ pip3 install pandas
(corona) $ ls -l ~/virtualEnv/corona/lib/python3.9/site-packages/
...
drwxr-xr-x  21 xxx  staff     672 11 25 02:17 pandas
drwxr-xr-x  11 xxx  staff     352 11 25 02:17 pandas-1.1.4.dist-info
(useful lib : pandas for data analysis / dash for dashboard / jupyterlab for browser python interpreter)
$ pip3 install pandas
$ pip3 install dash==1.17.0
$ pip3 install jupyterlab

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です