Ubuntu Installation Pycharm

Source: Internet
Author: User
Tags java jdk 8 linux mint

Reprint: HTTP://WWW.CNBLOGS.COM/ZHCNCN/P/4027025.HTML1. Download http://www.jetbrains.com/pycharm/download/

Select Linux tab and choose Download free community Edition "1". The current version is 3.4

2. Installing Pycharm

Install according to the installation instruction "2" given by the official website.

(1) Copy the pycharm-*.tar.gz to the desired installation location (make sure you have RW permissions for that directory)

$ CD downloads/

(2) Unpack the pycharm-*.tar.gz using the following Command:tar XFZ pycharm-*.tar.gz

$ tar xfz pycharm-*.tar.gz

(3) Remove the pycharm-*.tar.gz to save disk space (optional)

$ RM pycharm-*.tar.gz

(4) Run pycharm.sh from the bin subdirectory

$ CD pycharm-community-3.4.1/bin/

$./pycharm.sh

However, the installation begins with the following error:

Error:cannot Start Pycharm

No JDK found. Please validate either PYCHARM_JDK, jdk_home or java_home environment variable points to valid JDK installation.

Open pycharm.ch file to view, find the error place in:

Message () {  TITLE
= "Cannot Start Pycharm"
  If [-T 1]; Then    echo "ERROR: $TITLE \n$1"  elif [-n ' which zenity '], then    zenity--error--title= "$TITLE"--text= "$" 
   elif [-n ' which Kdialog '];  Then    kdialog--error--title "$TITLE" "$"  elif [-n ' which xmessage ']; then    xmessage-center "error: $TITLE: $ "  elif [-n ' which notify-send ']; then    notify-send" ERROR: $TITLE: $ "  Else    
echo "ERROR: $TITLE \n$1"
  fi}#---------------------------------------------------------------------# Locate a JDK installation directory which 'll be used to run the ide.# Try (in order): Pycharm_jdk, Jdk_home, Java_home, "JAVA" in path.#------------------------- --------------------------------------------if [-N ' $PYCHARM _jdk "-a-x" $PYCHARM _jdk/bin/java "]; Then jdk= "$PYCHARM _jdk" elif [-N "$JDK _home"-a-x "$JDK _home/bin/java"]; Then jdk= "$JDK _home" elif [-N "$JAVA _home"-a-x "$JAVA _home/bin/java"]; Then jdk= "$JAVA _home" Else java_bin_path= ' which JAVA ' if [-N ' $JAVA _bin_path "]; Then if ["$OS _type" = "FreeBSD"-o "$OS _type" = "Midnightbsd"]; Then java_location= ' Javavm_dryrun=yes JAVA | "$GREP" ' ^java_home ' | "$CUT"-c11-' if [-X ' $JAVA _location/bin/java "]; Then jdk= "$JAVA _location" fi elif ["$OS _type" = "SunOS"]; Then java_location= "/usr/jdk/latest" if [-X "$JAVA _location/bin/java"]; Then jdk= "$JAVA _location" fi elif ["$OS _type" = "DArwin "]; Then java_location= '/usr/libexec/java_home ' if [-X ' $JAVA _location/bin/java "]; Then jdk= "$JAVA _location" fi fi if [-Z ' $JDK "-a-x" $READLINK "-a-x" $XARGS "-a-x" $DIRNAME "]; Then java_location= ' "$READLINK"-F "$JAVA _bin_path" ' Case "$JAVA _location" in */jre/bin/java) JA Va_location= ' echo ' $JAVA _location | "$XARGS" "$DIRNAME" | "$XARGS" "$DIRNAME" | "$XARGS" "$DIRNAME" "if [!-d" $JAVA _location/bin "];        Then java_location= "$JAVA _location/jre" FI; *) java_location= ' echo ' $JAVA _location | "$XARGS" "$DIRNAME" |      "$XARGS" "$DIRNAME" ';; Esac if [-X "$JAVA _location/bin/java"];  Then jdk= "$JAVA _location" fi fi fifiif [
-Z "$JDK"
]; Then  
"No JDK found. Please validate either PYCHARM_JDK, jdk_home or java_home environment variable points to valid JDK installation. "
  Exit 1fi

Description The JDK location path was not found. The JDK needs to be installed and configured.

3. Installing the JDK

First check whether Ubuntu12.04 support JDK8, found or supported. Then install it with confidence.

Refer to the "3" method to install by setting up the source warehouse. (Refer to "5" "6" If you want to install manually)

Important:this PPA supports Ubuntu 14.04, 13.10, 12.04 and 10.04 as well as the corresponding Linux Mint versions. Ubuntu 13.04 and 12.10 is no longer supported by Canonical

(1) Go back to the home directory: "~", then execute a few command

sudo add-apt-repository ppa:webupd8team/javasudo apt-get updatesudo apt-get Install Oracle-java8-installer

The Oracle License dialog box is removed during the installation process, and you can choose to accept it.

(2) When the installation is complete, run "java-version" or "javac-version" to see if the installation is successful. If you get an output similar to the following, it indicates that the installation was successful.

$ Java-versionjava Version "1.8.0_20" Java (tm) SE Runtime Environment (build 1.8.0_20-b26) Java HotSpot (tm) 64-bit Server V M (build 25.20-b23, Mixed mode) $ Javac-versionjavac 1.8.0_20

(3) in "3" said, if you want to automatically set up the Java 8 environment variables, you can use the following command:

Http://www.webupd8.org/2012/01/install-oracle-java-jdk-7-in-ubuntu-via.html
Http://www.webupd8.org/2012/09/install-oracle-java-8-in-ubuntu-via-ppa.html

sudo apt-get install Oracle-java8-set-default

After I use this command, I run echo $JAVA _home in terminal without any output. It doesn't seem to have any effect. It is possible that when you finish configuring repository at the beginning, you can try it later by using this command at the time of installation.

UPDATED: Use the sudo apt-get install Oracle-java8-set-default to test the echo $JAVA _home and still have no $java_home environment variables. Manual setup is still required.

Because some programs may need to $JAVA _home environment variables by default at run time, it is still necessary to set the environment variables.

4. Configuring $java_home Environment variables

Refer to "4" in Setting the "java_home" Environment the variable section for Setup.

(1) Find out the path of your Java installation:

sudo update-alternatives--config java

It will return a result similar to the following, listing all Java Runtime Environment JRE installed natively. (A total of 2: JDK7 and openjdk6,0 and 2 are the same, the difference between Auto mode and manual mode)

There is 2 choices for the alternative Java (Providing/usr/bin/java). Selection    Path                                            priority   Status------------------------------------------------------------* 0            / Usr/lib/jvm/java-7-oracle/jre/bin/java          1062      Auto mode  1            /usr/lib/jvm/java-6-openjdk-amd64/jre/ Bin/java   1061      manual mode  2            /usr/lib/jvm/java-7-oracle/jre/bin/java          1062      Manual Modepress Enter to keep the current choice[*], or type selection number:

The respective JRE installation paths are:

0./usr/lib/jvm/java-7-oracle

1./usr/lib/jvm/java-6-openjdk-amd64

2./usr/lib/jvm/java-7-oracle

In my native execution of sudo update-alternatives--config java results are:

Selection    Path                                     priority   Status------------------------------------------------------------  0            /usr/lib/jvm/java-8-oracle/jre/bin/java   1         auto mode* 1            /usr/lib/jvm/java-8-oracle/jre/bin/java   1         manual modepress Enter to keep the current choice[*], or type selection number:

Visible only one Java environment is installed: JDK8. It corresponds to the installation path:

/usr/lib/jvm/java-8-oracle

(2) Edit/etc/environment file

sudo nano/etc/environment

Copy the above path/usr/lib/jvm/java-8-oracle, and add the following line

Java_home= "/usr/lib/jvm/java-8-oracle"

(3) Reload the file so that it takes effect immediately without having to log off and log back on

Source/etc/environment

(4) test with the following command

Echo $JAVA _home

Will output the path/usr/lib/jvm/java-8-oracle that you just set.

5. Install Pycharm again

(1) CD to downloads/pycharm-community-3.4.1/bin/directory, execute./pycharm.sh. Ask if you want to import settings, and choose not to import->ok.

(2) Initial setup, keep the default->ok.

(3) Create a launcher script, you need to enter a password.

User name
yueting3527
Registration code
===== LICENSE BEGIN =====
93347-12042010
00001FMHemWIs "6wozmznat3igxkxj
2!nv2i6kso48hggla9jngjq5okz1us
ffr8k "ngzjhzjqt6ibg!1fbqzn9! Vi
===== LICENSE END =====

(4) The following screen appears, indicating that the installation was successful.

(5) Create New project, creating a test project, with the interpreter selecting Python2.7 by default.

Then on the newly created project: right-click->new->python file, create a new Py01, write code, click the Run button->run Py01 run.

6. Set the Quick Start mode of pycharm under Ubuntu

Under Ubuntu, every time you want to find the folder where pycharm.sh, execute./pycharm.sh, very troublesome. It's a good idea to create a shortcut. "7"

Ubuntu shortcuts are placed in/usr/share/applications, first create a pycharm.desktop in this directory

$ sudo gedit/usr/share/applications/pycharm.desktop

Then enter the following, noting that exec and icon need to find the correct path

[Desktop Entry] Type=applicationname=pycharmgenericname=pycharm3comment=pycharm3:the Python ideexec= "/XXX/ Pycharm-community-3.4.1/bin/pycharm.sh "%ficon=/xxx/pycharm-community-3.4.1/bin/pycharm.pngterminal= Pycharmcategories=pycharm;

Then double-click to open, then lock to the launcher is good.

Reference

"1" Download pycharm (http://www.jetbrains.com/pycharm/download/)

"2" Installation instructions for Linux (http://www.jetbrains.com/pycharm/download/installation_instructions.jsp?os=linux)

"3" INSTALL ORACLE JAVA 8 in UBUNTU VIA PPA REPOSITORY [JDK8] (http://www.webupd8.org/2012/09/ install-oracle-java-8-in-ubuntu-via-ppa.html)

"4" How to Install Java on Ubuntu with Apt-get (https://www.digitalocean.com/community/tutorials/ How-to-install-java-on-ubuntu-with-apt-get)

"5" Ubuntu Tutorial-Manually install Oracle Java JDK 8 (http://www.bkjia.com/Linuxjc/813257.html) in Ubuntu

"6" Ubuntu Installation Jdk1.6 graphics (http://blog.csdn.net/u013027996/article/details/32916085)

"7" Method of creating Launcher program under Ubuntu (http://cssha.com/create-start-program-in-ubuntu/)

Ubuntu Installation Pycharm

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.