Original Address http://www.cnblogs.com/zhcncn/p/4027025.html
1. 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 di Rectory)
$ 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): Pycha RM_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 message "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 version S. 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-version
Output:
Java version "1.8.0_20" Java (tm) SE Runtime Environment (build 1.8.0_20-b26) Java HotSpot (tm) 64-bit Server VM (Build 25.20- B23, Mixed mode)
Or
Javac-version
Output:
Javac 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:
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 /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/ Java 1061 manual mode /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, 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.
(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.
Ubuntu12.04 installation Pycharm