Ubuntu下安装、激活并配置Pycharm
最近在学习Python这门语言,到了需要Python编译器学习的阶段,通过网上了解各个Python编译器的优缺点,最后选择了pycharm作为Python学习的开发环境。
pycharm是Python 的一款非常优秀的集成开发环境,除了具有一般 IDE 所必备功能外,还可以在 Windows、Linux、macOS 下使用。在Ubuntu环境下安装和配置pycharm过程中遇到了一些问题,不过最终通过网上了解各种方法解决了这些问题并安装成功。下面简单叙述一下本人在Ubuntu 18.04
版本中安装并配置pycharm 2018.1.4
的过程。
1、首先去JB官网下载适用于Linux系统的Pycharm
https://www.jetbrains.com/pycharm/download/#section=linux
2、 安装
(1)右键安装包提取到桌面或者终端下输入解压命令:
tar -zxvf pycharm-professional-2018.1.4.tar.gz -C ~/Desktop
(2)将解压后得到的目录移动到/opt目录
/opt
是用来存放主机额外安装的软件的目录,将解压后的目录移动到/opt目录下,可以方便其他用户使用。
在终端里输入以下命令:
sudo mv pycharm-2018.1.4/ /opt/
(3)启动pycharm
首先要在终端里输入以下命令进入pycharm的bin目录
cd /opt/pycharm-2018.1.4/bin
输入以下命令启动pycharm主程序,第一次启动会有点慢,输入启动命令后稍等片刻。
./pycharm.sh
注:每次一这样的形式启动固然很费劲,后面会介绍如何创建快捷方式
3、 注册激活
因为我们下载安装的是pycharm专业版本,所以注册激活是免不了的。有三种方式可以注册激活pycharm,分别为授权服务器激活、注册码激活、破解补丁激活。
具体可以参考https://blog.csdn.net/u014044812/article/details/78727496
授权服务器激活没试过,这里只介绍后面两种:
(1)注册码激活
在输入注册码之前修改一下/etc/hosts文件(如果pycharm程序没关闭,终端就会处在被占用状态,可以重新打开一个终端)
# 1、在终端里输入以下命令,进入/etc目录 sudo /etc # 2、hosts文件默认权限是644,不能够被我们所改写,所以需要修改权限 sudo chmod 777 hosts # 3、打开hosts文件 gedit hosts # 4、在打开的hosts文件最后加入一行代码 0.0.0.0 account.jetbrains.com
然后将激活码填到pycharm的active code对应框里,关于激活码,可以到http://idea.lanyus.com/获取,
激活码:
K71U8DBPNE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m0oFKLl/GzoRykGjAYMRYwFAYDVQQDDA1KZXRQcm9maWxlIENBggkA0myxg7KDeeEwEwYDVR0lBAwwCgYIKwYBBQUHAwEwCwYDVR0PBAQDAgWgMA0GCSqGSIb3DQEBCwUAA4ICAQC9WZuYgQedSuOc5TOUSrRigMw4/+wuC5EtZBfvdl4HT/8vzMW/oUlIP4YCvA0XKyBaCJ2iX+ZCDKoPfiYXiaSiH+HxAPV6J79vvouxKrWg2XV6ShFtPLP+0gPdGq3x9R3+kJbmAm8w+FOdlWqAfJrLvpzMGNeDU14YGXiZ9bVzmIQbwrBA+c/F4tlK/DV07dsNExihqFoibnqDiVNTGombaU2dDup2gwKdL81ua8EIcGNExHe82kjF4zwfadHk3bQVvbfdAwxcDy4xBjs3L4raPLU3yenSzr/OEur1+jfOxnQSmEcMXKXgrAQ9U55gwjcOFKrgOxEdek/Sk1VfOjvS+nuM4eyEruFMfaZHzoQiuw4IqgGc45ohFH0UUyjYcuFxxDSU9lMCv8qdHKm+wnPRb0l9l5vXsCBDuhAGYD6ss+Ga+aDY6f/qXZuUCEUOH3QUNbbCUlviSz6+GiRnt1kA9N2Qachl+2yBfaqUqr8h7Z2gsx5LcIf5kYNsqJ0GavXTVyWh7PYiKX4bs354ZQLUwwa/cG++2+wNWP+HtBhVxMRNTdVhSm38AknZlD+PTAsWGu9GyLmhti2EnVwGybSD2Dxmhxk3IPCkhKAK+pl0eWYGZWG3tJ9mZ7SowcXLWDFAk0lRJnKGFMTggrWjV8GYpw5bq23VmIqqDLgkNzuoog==
(2)破解补丁激活
这种方式有效期至2099年12月31号,不出意外的话,够用了。破解补丁下载连接
# 1、将下载完的破解补丁移动到/opt/pycharm-2018.1.4/bin目录下 sudo mv JetbrainsCrack-2.9-release-enc.jar /opt/pycharm-2018.1.4/bin # 2、切换工作目录 cd cd /opt/pycharm-2018.1.4/bin
切换完目录后,我们需要修改该目录下的两个文件:pycharm.vmoptions 和 pycharm64.vmoptions
# 3、打开pycharm.vmoptions sudo gedit pycharm.vmoptions # 4、在打开的文件中最后一行填写以下代码 (如果破解补丁放在别的位置,后别路径参数也要相应的修改) -javaagent:/opt/pycharm-2018.1.4/bin/JetbrainsCrack-2.8-release-enc.jar
注:上面第3、4步只是以pycharm.vmoptions为例,pycharm64.vmoptions也要按照这样的步骤来。
回到pycharm启动界面,选择激活码激活,输入以下代码
这里参考的是https://blog.csdn.net/u014044812/article/details/78727496,其中licenseeName、assigneeName、assigneeEmail等一些参数可以自己修改
ThisCrackLicenseId-{ "licenseId":"11011", "licenseeName":" ", "assigneeName":"ryan", "assigneeEmail":"", "licenseRestriction":"", "checkConcurrentUse":false, "products":[ {"code":"II","paidUpTo":"2099-12-31"}, {"code":"DM","paidUpTo":"2099-12-31"}, {"code":"AC","paidUpTo":"2099-12-31"}, {"code":"RS0","paidUpTo":"2099-12-31"}, {"code":"WS","paidUpTo":"2099-12-31"}, {"code":"DPN","paidUpTo":"2099-12-31"}, {"code":"RC","paidUpTo":"2099-12-31"}, {"code":"PS","paidUpTo":"2099-12-31"}, {"code":"DC","paidUpTo":"2099-12-31"}, {"code":"RM","paidUpTo":"2099-12-31"}, {"code":"CL","paidUpTo":"2099-12-31"}, {"code":"PC","paidUpTo":"2099-12-31"} ], "hash":"2911276/0", "gracePeriodDays":7, "autoProlongated":false}
以上两种激活方式亲测有效
4、 Pycharm相关配置
–
(1)创建快捷方式
在欢迎界面点击下边的Configure–>选择“Create Desktop Entry”–>勾选“Create the entry for all users”–>OK,
之后可以在所有程序里找到pycharm图标,右键–>添加到收藏夹
(2)配置默认解释器(当然也可以创建python时再配置)
同样在欢迎界面点击下边的Configure–>选择Settings
点击左侧的Project Interpreter–>右侧下拉按钮–>选择Show All
在弹出的界面点击“+”按钮
选择System Interpreter
(3)提示 No model named “distutils .core”
的解决办法
: 设置好默认解释器后,当点击OK时,下面可能会提示“Install packaging tools”,可当我们确认安装后,会报出错误:No model named “distutils .core”。即使当时管,后期创建项目时也会提示
原因是ubuntu18.04
只有python3解释器
,默认没有安装 pip或pip3 ,需要安装 python3-pip,即可解决,在终端中输入以下代码即可解决
sudo apt-get install python3-pip
(4)pycharm字体设置