Python 및 필요한 모든 패키지 설치 경험. Ubuntu 18.04에서 테스트되었습니다 (17.10에서는 테스트되지 않음). 우분투 전문가가 아니기 때문에 틀릴 수 있습니다.
명령 대신 apt
( apt-get
) 명령을 사용하는 것이 좋습니다 pip
.
- apt는 우분투 패키지와 배포판에서만 테스트되었습니다.
- sudo apt update / upgrage 명령은 패키지를 최신 상태로 유지합니다.
- 자신의 로컬 계정뿐만 아니라 Ubuntu 시스템의 모든 사용자를위한 설치 / 업데이트 패키지를 원할 경우
- 우분투 용 패키지를 원한다면 운영 체제에서도 사용할 수 있습니다.
다른 버전의 패키지의 경우 가상 환경을 사용해야합니다. 또는 소스 코드에서 패키지를 빌드하고 테스트하십시오 (전문가에게만 해당).
현재 python3을 삭제하지 마십시오. 그렇지 않으면 Ubuntu OS가 중단됩니다.
# Refreshing the repositories
sudo apt update
# Update software
sudo apt upgrade
# Install Python and necessary packages.
# Install pip for 2.7 and then python 2.7 itself
sudo apt install python-pip
sudo apt install python2.7
# Install pip for 3.6
sudo apt install python3-pip
# Install currently supported by Ubuntu python 3.x version.
sudo apt install python3
# Don't delete current python3, otherwise Ubuntu OS will BROKE.
# Better don't install the newest versions 3.7, 3.8, 4.0, etc. on the whole OS (globally).
# This command works, but it's a bad idea to use it -- sudo apt install python3.7
# in this case import of numpy (import numpy) and other modules will fail for python3.7,
# because 3.6 is the current (global) python version for Ubuntu, not 3.7.
# Use "sudo apt install python3" not "sudo apt install python3.7" command for python 3.x installation.
# If you need 3.7 or newer, use local virtual environment.
# It's a bad idea to have several versions of python 3.x globally at the same time.
# Use only currently supported by Ubuntu python 3.x version globally. At this moment it is 3.6.
# Install numpy, scipy, matplotlib, scikit-learn, scikit-image,
# opencv with contributions, pandas, pillow, psutil, spur, cython,
#ipython, jupyter, git.
sudo apt install python-numpy
sudo apt install python3-numpy
sudo apt install python-scipy
sudo apt install python3-scipy
sudo apt install python-matplotlib
sudo apt install python3-matplotlib
sudo apt install python-sklearn
sudo apt install python3-sklearn
sudo apt install python-skimage
sudo apt install python3-skimage
sudo apt install python-opencv
sudo apt install python3-opencv
sudo apt install python-pandas
sudo apt install python3-pandas
sudo apt install python-pil
sudo apt install python3-pil
sudo apt install python-pil.imagetk # if the imageTk import doesn't work
sudo apt install python3-pil.imagetk # if the imageTk import doesn't work
sudo apt install python-psutil
sudo apt install python3-psutil
sudo apt install python-spur
sudo apt install python3-spur
sudo apt install cython
sudo apt install cython3
sudo apt install python-ipython
sudo apt install python3-ipython
sudo apt install ipython
sudo apt install ipython3
sudo apt install jupyter
sudo apt install git
# To have both python 2 and 3 available on jupyter
sudo apt install python-ipykernel
sudo apt install python3-ipykernel
# To check installed packages use commands
python
# and
python3
# Then type in python 2 or 3 console
import numpy
import scipy
import matplotlib
import sklearn
import skimage
exit()
# To check ipython
ipython
exit
ipython3
exit
# To check jupyter run
jupyter notebook
# and check both version of python 2 and 3 in "New" menu
# To remove package (don't remove python3 -- it'll broke your Ubuntu)
sudo apt purge --auto-remove packagename
# To search for the package:
apt search packagename
# Install PyCharm Community edition
sudo snap install pycharm-community --classic
# To check PyCharm installation enter:
pycharm-community