Linux系统下python开发环境搭建(Anaconda+Pycharm安装)

Linux系统下python开发环境搭建(Anaconda+Pycharm安装)

本人是在Redhat6.8 64位系统下 anaconda 对应python3.6版:Anaconda3-5.2.0-Linux-x86_64.sh 。
在anaconda包安装以后python环境下已集成大多常用的基础开发包,因此推荐anaconda python安装后,再安装其它深度学习等需要的扩展包。
anaconda和python对应版本可以从下面链接查找:
https://docs.anaconda.com/anaconda/packages/oldpkglists/

安装Anaconda

anaconda下载地址:
清华镜像 https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/
中科大镜像 https://mirrors.ustc.edu.cn/anaconda/archive/
https://repo.continuum.io/archive/
官网 https://www.anaconda.com/distribution/ (最新版)
下载后,打开terminal,转到下载包所在目录 。
输入待安装的包名,运行,执行./Anaconda3-5.2.0-Linux-x86_64.sh ,具体如下:

[dhy@~]cd /mnt/hgfs/D/download/install_src/PythonPacket
[dhy@Master PythonPacket]$ ./Anaconda3-5.2.0-Linux-x86_64.sh 

Welcome to Anaconda3 5.2.0

In order to continue the installation process, please review the license
agreement.
Please, press ENTER to continue

......

Do you accept the license terms? [yes|no]
[no] >>> 
Please answer 'yes' or 'no':'
>>> yes

......
Do you wish the installer to prepend the Anaconda3 install location
to PATH in your /home/dhy/.bashrc ? [yes|no]
[no] >>> 
You may wish to edit your .bashrc to prepend the Anaconda3 install location to PATH:

export PATH=/home/dhy/anaconda3/bin:$PATH

Thank you for installing Anaconda3!
[dhy@Master PythonPacket]$

由于没有及时跟进,默认选择anaaconda3安装目录不加入环境变量。则需要手动设置环境变量:
vim /etc/profile
在末尾加入 export PATH=/home/dhy/anaconda3/bin:$PATH 并更新 执行source (需要切换到root用户才有权限)
可以通过conda list查看安装的包。具体如下:

[root@Master Desktop]# source /etc/profile 
[root@Master Desktop]# conda list
# packages in environment at /home/dhy/anaconda3:
#
# Name                    Version                   Build  Channel
_ipyw_jlab_nb_ext_conf    0.1.0            py36he11e457_0  
alabaster                 0.7.10           py36h306e16b_0  
anaconda                  5.2.0                    py36_3  
anaconda-client           1.6.14                   py36_0  
anaconda-navigator        1.8.7                    py36_0  
anaconda-project          0.8.2            py36h44fb852_0  
asn1crypto                0.24.0                   py36_0  
......

在终端输入python即可运行,提示python 3.6.5版。如下图:
在这里插入图片描述

安装Pycharm

从下面网址下载安装包,选择系统和版本(Professional :专家版试用后需付费 或 Community 社区版免费)。一般选择Community版就够用了。
下载地址: https://www.jetbrains.com/pycharm/download/
在这里插入图片描述
查看Install-Linux-tar.txt 详细介绍了安装过程

====
  Linux Installation Instructions
  ------------------------------------------------------------------------------
  1. Unpack the PyCharm distribution archive that you downloaded to
     where you wish to install the program. We will refer to this destination
     location as your {installation home} below.

  2. Open a console and cd into "{installation home}/bin" and type:

       ./pycharm.sh

     to start the application. As a side effect, this will initialize various
     configuration files in the ~/.PyCharmCE2019.1 directory.

  3. [OPTIONAL] Add "{installation home}/bin" to your PATH environment
     variable so that you may start PyCharm from any directory.

  4. [OPTIONAL] To adjust the value of the JVM heap size, create
      ~/.PyCharmCE2019.1/config/pycharm.vmoptions (or pycharm64.vmoptions
      if using a 64-bit JDK), and set the -Xms and -Xmx parameters. To see how
      to do this, you can reference the vmoptions file under
      "{installation home}/bin" as a model.

  [OPTIONAL] Changing the location of "config" and "system" directories

执行安装命令。进入pycharm解压文件夹的bin目录执行 ./pycharm.sh
在这里插入图片描述
安装配置过程。
由于第一次执行后弹出配置选项后,中断,下次打开后出现Jetbrains Privacy Policy 界面,勾选接受即可直接进行软件运行界面。没有网上其它人的配置过程。则配置环境变量实现命令行直接运行, 设置桌面快捷方式均需要后来手动完成。

创建桌面快捷链接可以采用建立软链接的方法,请参考:Linux创建桌面快捷方式的三种方法

方法1: 在桌面上建立 jetbrains-pycharm-ce.desktop 文件添加类似下面文件内容。

#!/usr/bin/env xdg-open

[Desktop Entry]
Version=1.0
Type=Application
Name=PyCharm Community Edition
Icon=/usr/local/software/pycharm-community-2019.1.1/bin/pycharm.svg
Exec="/usr/local/software/pycharm-community-2019.1.1/bin/pycharm.sh" %f
Comment=Python IDE for Professional Developers
Categories=Development;IDE;
Terminal=false
StartupWMClass=jetbrains-pycharm-ce

方法2 创建软链接:
ln -s /usr/local/software/pycharm-community-2019.1.1/bin/pycharm.sh ~/Desktop

创建桌面快捷方式后,出现无JDK的提示界面。
在这里插入图片描述
本人已经在root 用户下安装过java了。经查看是当时环境变量是在home目录 .bashrc文件 设置的。
仅对登陆的用户有效。要使对所有用户生效,需要在 /etc/profile 目录下设置环境变量(需要有 ROOT用户权限):
在这里插入图片描述
注意: 需要在执行 "source /etc/profile"之后才能使环境变量生效;
现在运行 pycharm.sh或 点击快捷方式 就可以运行了。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值