1. ä¸è½½
éæ©Linux Tabï¼éæ©ä¸è½½å
è´¹çCommunity Editionã1ããå½åçæ¬æ¯3.4
2. å®è£
PyCharm
æç
§å®ç½ç»åºçå®è£
æ导ã2ãè¿è¡å®è£
ã
ï¼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
ä½æ¯å®è£
å¼å§ï¼åºç°å¦ä¸é误ï¼
ERROR: Cannot start PyCharm
No JDK found. Please validate either PYCHARM_JDK, JDK_HOME or JAVA_HOME environment variable points to valid JDK installation.
æå¼pycharm.chæ件æ¥çï¼åç°æ¥éçå°æ¹å¨ï¼
message()
{
TITLE
="Cannot start PyCharm"
if [ -t 1 ]; then
echo "ERROR: $TITLE\n$1"
elif [ -n `which zenity` ]; then
zenity --error --title="$TITLE" --text="$1"
elif [ -n `which kdialog` ]; then
kdialog --error --title "$TITLE" "$1"
elif [ -n `which xmessage` ]; then
xmessage -center "ERROR: $TITLE: $1"
elif [ -n `which notify-send` ]; then
notify-send "ERROR: $TITLE: $1"
else
echo "ERROR: $TITLE\n$1"
fi
}
# ---------------------------------------------------------------------
# Locate a JDK installation directory which will 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)
JAVA_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
fi
fi
if [
-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 1
fi
说æ没ææ¾å°JDK location pathãéè¦å®è£
并é
ç½®JDKäºã
3. å®è£
JDK
é¦å
æ¥äºä¸ä¸Ubuntu12.04æ¯å¦æ¯æJDK8ï¼åç°è¿æ¯æ¯æçãé£å°±æ¾å¿å®è£
å§ã
åç
§ã3ãçæ¹æ³ï¼éè¿è®¾ç½®æºä»åºçæ¹å¼å®è£
ãï¼å¦ææ³æå¨å®è£
ï¼è¯·åèã5ãã6ãï¼
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 are no longer supported by Canonical
ï¼1ï¼è¿åå°Homeç®å½ï¼â~âï¼ç¶åä¾æ¬¡æ§è¡ä¸ä¸å æ¡command
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
å®è£
è¿ç¨ä¸ä¼è·³åºOracle license对è¯æ¡ï¼éæ©æ¥åå°±æ¯äºã
ï¼2ï¼å®è£
å®æåï¼è¿è¡"java -version"æè
"javac -version"æ¥çæ¯å¦å®è£
æåãå¦æå¾å°ç±»ä¼¼å¦ä¸çè¾åºï¼è¡¨æå®è£
æåäºã
$ java -version
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)
$ javac -version
javac 1.8.0_20
ï¼3ï¼ å¨ã3ãä¸è¯´éï¼å¦ææ³automatically set up the Java 8 environment variablesï¼å¯ä»¥ä½¿ç¨ä¸é¢ç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
æ使ç¨è¯¥commandåï¼å¨Terminalä¸è¿è¡ echo $JAVA_HOMEï¼æ²¡æä»»ä½è¾åºãçæ¥æ¯æ²¡èµ·ä»ä¹ä½ç¨ãæå¯è½æ¯å¨ä¸å¼å§é
ç½®å®repositoryåï¼å®è£
æ¶ä½¿ç¨è¯¥æ¡å½ä»¤ï¼å¯ä»¥ä»¥åå°è¯ä¸ä¸ã
UPDATED: ä½¿ç¨ sudo apt-get install oracle-java8-set-defaultï¼æµè¯echo $JAVA_HOMEï¼ä»ç¶æ¯æ²¡æ$JAVA_HOMEç¯å¢åéçãè¿æ¯éè¦æå¨è®¾ç½®ã
ç±äºä¸äºç¨åºå¨è¿è¡æ¶å¯è½é»è®¤éè¦ $JAVA_HOME ç¯å¢åéï¼å æ¤è¿æ¯éè¦è®¾ç½®ä¸ä¸ç¯å¢åéçã
4. é
ç½®$JAVA_HOME ç¯å¢åé
åèã4ãä¸ Setting the "JAVA_HOME" environment variable ä¸èè¿è¡è®¾ç½®ã
ï¼1ï¼Find out the path of your Java installation:
sudo update-alternatives --config java
å®å°è¿å类似å¦ä¸çç»æï¼ååºäºæ¬æºæå®è£
çææJavaè¿è¡æ¶ç¯å¢JREãï¼å
±æ2个ï¼JDK7åOpenJDK6ï¼0å2æ¯åä¸ä¸ªï¼auto modeåmanual modeçå·®å«ï¼
There are 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 mode
Press enter to keep the current choice[*], or type selection number:
对åºçå个JREç å®è£
è·¯å¾åå«ä¸ºï¼
0. /usr/lib/jvm/java-7-oracle
1. /usr/lib/jvm/java-6-openjdk-amd64
2. /usr/lib/jvm/java-7-oracle
å¨ææ¬æº æ§è¡ sudo update-alternatives --config java çç»æ为ï¼
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 mode
Press enter to keep the current choice[*], or type selection number:
å¯è§åªå®è£
äºä¸ä¸ªJavaç¯å¢ï¼ JDK8ãå®å¯¹åºçå®è£
è·¯å¾ä¸ºï¼
/usr/lib/jvm/java-8-oracle
ï¼2ï¼ç¼è¾/etc/environmentæ件
sudo nano /etc/environment
å¤å¶ä¸é¢çè·¯å¾ /usr/lib/jvm/java-8-oracleï¼æ·»å å¦ä¸ä¸è¡
JAVA_HOME="/usr/lib/jvm/java-8-oracle"
ï¼3ï¼ Reload该æ件ï¼ä½¿ä¹ç«å³çæï¼èä¸å¿
注é并éæ°ç»å½
source /etc/environment
ï¼4ï¼ä½¿ç¨ä¸é¢çå½ä»¤æµè¯
echo $JAVA_HOME
ä¼è¾åºåææ设置çè·¯å¾ /usr/lib/jvm/java-8-oracleã
5. å次å®è£
PyCharm
ï¼1ï¼cdå°Downloads/pycharm-community-3.4.1/bin/ç®å½ï¼æ§è¡./pycharm.shã询é®æ¯å¦å¯¼å
¥settingsï¼éæ©ä¸å¯¼å
¥->OK.
(2) åå§è®¾ç½®ï¼ä¿æé»è®¤->OK.
(3) å建ä¸ä¸ªLauncherèæ¬ï¼éè¦è¾å
¥å¯ç ã
ç¨æ·å
yueting3527
注åç
===== LICENSE BEGIN =====
93347-12042010
00001FMHemWIs"6wozMZnat3IgXKXJ
2!nV2I6kSO48hgGLa9JNgjQ5oKz1Us
FFR8k"nGzJHzjQT6IBG!1fbQZn9!Vi
===== LICENSE END =====
ï¼4ï¼åºç°ä¸é¢çç»é¢ï¼è¡¨æå®è£
æåäºã
ï¼5ï¼ Create New Projectï¼å建ä¸ä¸ªæµè¯å·¥ç¨ï¼è§£éå¨é»è®¤éæ©äºPython2.7ã
ç¶åå¨æ°å建çå·¥ç¨ä¸ï¼ç¹å³é®->New->Python File, å建ä¸ä¸ªæ°çæ件Py01ï¼å代ç ï¼ç¹Runæé®->Run Py01è¿è¡ã
6. 设置Ubuntuä¸Pycharmçå¿«æ·å¯å¨æ¹å¼
å¨Ubuntuä¸ï¼æ¯æ¬¡é½è¦æ¾å° pycharm.shæå¨çæ件夹ï¼æ§è¡./pycharm.shï¼é常麻ç¦ãæ好è½å建ä¸ä¸ªå¿«æ·æ¹å¼ãã7ã
Ubuntuçå¿«æ·æ¹å¼é½æ¾å¨/usr/share/applicationsï¼é¦å
å¨è¯¥ç®å½ä¸å建ä¸ä¸ªPycharm.desktop
$ sudo gedit /usr/share/applications/Pycharm.desktop
ç¶åè¾å
¥ä»¥ä¸å
容ï¼æ³¨æExecåIconéè¦æ¾å°æ£ç¡®çè·¯å¾
[Desktop Entry]
Type=Application
Name=Pycharm
GenericName=Pycharm3
Comment=Pycharm3:The Python IDE
Exec="/XXX/pycharm-community-3.4.1/bin/pycharm.sh" %f
Icon=/XXX/pycharm-community-3.4.1/bin/pycharm.png
Terminal=pycharm
Categories=Pycharm;
ç¶ååå»æå¼ï¼åéå®å°å¯å¨å¨å°±å¥½äº.