##How to install Python in Linux?
1. Install pycharm
Pycharm download address: http://www.jetbrains.com/pycharm/download/ (it is recommended to choose the open source community version)
2.2 JDK environment for installing pycharm
Pycharm requires JDK environment analysis, otherwise an error will be reported during the installation process.
Execute several commands in sequence:
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer(此处环境包较大,如下载中途停止退出,重复执行即可)
Copy after login
During the installation process, the Oracle license dialog box will pop up, just choose to accept it.
After the installation is complete, run "java -version" or "javac -version" to check whether the installation is successful. If you get output similar to the following, the installation is successful.
root@ubuntu:~# java -version
java version "1.8.0_66"
Java(TM) SE Runtime Environment (build 1.8.0_66-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.66-b17, mixed mode)
root@ubuntu:~# javac -version
javac 1.8.0_66
Configure Java_home environment
#sudo apt-get install oracle-java8-set-default
#echo JAVA_HOME="/usr/lib/jvm/java-8-oracle"
>> /etc/environment
#source /etc/environment
Copy after login
2.3 Install pycharm.sh
Unzip the installed pycharm installation package, unzip and execute pycharm .sh, just follow the default prompts.
Reference:
root@ubuntu:/opt# sudo tar -zxvf pycharm-community-5.0.1.tar.gz
root@ubuntu:/opt# sudo sh pycharm-community-5.0.1/bin/pycharm.sh
Copy after login
Then follow the default prompts and select OK to install.
Usually start pycharm and execute sudo sh pycharm-community-5.0.1/bin/pycharm.sh.
1. Reference webpage: http://www.cnblogs.com/zhcncn/p/4027025.html
2. Open your own Python file (omitted)
3. Solve the problem of No Python interperter selected in Pycharm. To put it simply, it means that the Python interpreter cannot be found where it is installed.
Method 1: whereis python
Method 2: which python
For example, /usr/bin/python in the picture is one of the paths to the interpreter.
Configure the interpreter path in Pycharm: file->settings, select the configuration interface on the right
After selecting the configuration interface: select Existing environment, then Select the path just now /usr/bin/python You can choose according to your actual situation.
The interface after selection is as shown above, then select your own script path. Note that if you want to use a terminal-like input method, select show command line afterwards.
4. Make sure your Python script path is set consistent with the one in the project.
5. Select debug to start debugging the program.
The above is the detailed content of How to install python on linux. For more information, please follow other related articles on the PHP Chinese website!