In this article, I would like to write a series of flow from uninstallation to installation when a problem occurs in anaconda etc.
$ sw_vers
ProductName: Mac OS X
ProductVersion: 10.15.2
BuildVersion: 19C57
Follow the steps below to uninstall
--Uninstall pyenv-virtualenv
$ brew uninstall pyenv-virtualenv
Uninstalling /usr/local/Cellar/pyenv-virtualenv/1.1.3... (20 files, 62.2KB)
--Uninstall pyenv
$ brew uninstall pyenv
Uninstalling /usr/local/Cellar/pyenv/1.2.14_1... (656 files, 2.4MB)
--Delete pyenv directory
$ rm -rf $(pyenv root)
This is the same as $ rm -rf ~ / .pyenv
Install pyenv with the following command
$ brew install pyenv
.bash_profile
Execute the following command
$ echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile
$ echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile
$ echo 'eval "$(pyenv init -)"' >> ~/.bash_profile
$ source ~/.bash_profile
--Get a list of python versions you can install --A list of installable versions is displayed as follows.
$ pyenv install --list
Available versions:
2.1.3
2.2.3
2.3.7
2.4.0
...
(abridgement)
...
3.0.1
3.1.0
3.1.1
3.1.2
...
(abridgement)
...
3.6.8
3.6.9
3.7.0
3.7-dev
3.7.1
3.7.2
3.7.3
3.7.4
3.7.5
3.7.5rc1
3.8.0
3.8-dev
3.9-dev
activepython-2.7.14
activepython-3.5.4
activepython-3.6.0
anaconda-1.4.0
anaconda-1.5.0
anaconda-1.5.1
anaconda-1.6.0
anaconda-1.6.1
anaconda-1.7.0
...
(abridgement)
...
anaconda3-5.1.0
anaconda3-5.2.0
anaconda3-5.3.0
anaconda3-5.3.1
anaconda3-2018.12
anaconda3-2019.03
anaconda3-2019.07
anaconda3-2019.10
...
(abridgement)
...
--This time, I want to use the anaconda environment, so specify the version you want from the above list. --I want to use anaconda, so execute the following command
$ pyenv install anaconda3-2019.10
If you want normal python, just do
$ pyenv install 3.7.5
--Get a list of available python environments
$ pyenv versions
--Python is out of date immediately after installation
$ python --version
Python 2.7.15
--Check the available python version
$ pyenv versions
system
* anaconda3-2019.10 (set by /Users/******/.pyenv/version)
--Specify the entire python version with the following command
$ pyenv global anaconda3-2019.10
--Check the version of python you are using --OK if it is set to the specified version
$ python --version
Python 3.7.4
--When the newly installed version is ʻanaconda3-2019.10`, the past version remains as follows.
$ cd ~/.pyenv/versions/
$ ls
anaconda3-2019.10/ anaconda3-5.3.1/
--If you were originally using the environment ʻanaconda3-5.3.1, execute the following command. --As it is, even if you execute the
rm command, it cannot be deleted with authority, so execute it with
sudo`.
$ sudo rm -rf ~/.pyenv/versions/anaconda3-5.3.1/
$ vim /etc/paths
--The contents of / etc / paths
look like this. Priority is given from the top.
1 /usr/local/bin
2 /usr/bin
3 /bin
4 /usr/local/sbin
5 /usr/sbin
6 /sbin
that's all
Recommended Posts