update-alternatives python

Python : 2019. 2. 22. 12:46
반응형

$ pip3 install meson

했는데

Collecting meson

Installing collected packages: meson

Successfully installed meson-0.49.2

You are using pip version 8.1.1, however version 19.0.3 is available.

You should consider upgrading via the 'pip install --upgrade pip' command.

이렇게 나와서

$ pip install --upgrade pip

했는데 

AttributeError: 'module' object has no attribute 'SSL_ST_INIT'

이렇게 나와서

$ sudo python -m easy_install --upgrade pyOpenSSL

이거 해주고 다시

$ sudo pip install --upgrade pip

하고나서 

$ pip3 install meson 했는데 pip3 가 없네.

$ sudo apt-get install python3 python3-pip ninja-build

해주고




$ which python

/usr/bin/python


$ which python3

/usr/bin/python3


$ which python3.5

/usr/bin/python3.5



sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 1

sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.7 2

sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 3

sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.5 4


이제 PIP 를 해보려고하는데

$  sudo pip3 list

Traceback (most recent call last):

  File "/usr/local/bin/pip3", line 9, in <module>

    from pip import main

ImportError: cannot import name 'main'


이런 에러가 나서


$ sudo python3 -m pip uninstall pip && sudo apt-get install python3-pip --reinstall 


이렇게 삭제후 재설치 해주고



$ which pip

/usr/local/bin/pip

$ which pip2

/usr/local/bin/pip2

$ which pip2.7 

/usr/local/bin/pip2.7

$ which pip3

/usr/local/bin/pip3

$ which pip3.5 

/usr/local/bin/pip3.5


$ ls -al /usr/local/bin/pip

-rwxr-xr-x 1 root root 215  2월 22 15:44 /usr/local/bin/pip

$ ls -al /usr/local/bin/pip2

-rwxr-xr-x 1 root root 215  2월 22 11:23 /usr/local/bin/pip2

$ ls -al /usr/local/bin/pip2.7

-rwxr-xr-x 1 root root 215  2월 22 11:23 /usr/local/bin/pip2.7

$ ls -al /usr/local/bin/pip3

-rwxr-xr-x 1 root root 215  2월 22 15:44 /usr/local/bin/pip3

$ ls -al /usr/local/bin/pip3.5

-rwxr-xr-x 1 root root 215  2월 22 15:44 /usr/local/bin/pip3.5



이것도 설정하려면 위와 같이 하면 된다.


반응형

'Python' 카테고리의 다른 글

python3 virtualenv  (0) 2020.04.06
python echo 서버  (0) 2018.02.06
python simple http server  (0) 2016.07.21
Posted by Real_G