Linux中Python环境变量的设置
来源:互联网 发布:母婴用品淘宝店 编辑:程序博客网 时间:2024/05/29 17:03
Linux中Python环境变量的设置
Python环境变量的查看与添加
这种添加python path环境变量的方式,只在当前脚本程序范围内起作用。若要在整个Linux环境中起作用,就要添加设置Linux的PYTHONPATH变量。
jxj@ubuntu1:~/TFFRCNN$ pythonPython 2.7.12 (default, Nov 19 2016, 06:48:10) [GCC 5.4.0 20160609] on linux2Type "help", "copyright", "credits" or "license" for more information.>>> import sys>>> sys.path['', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/PILcompat']>>> sys.path.insert(0, '/home/jxj/TFFRCNN')>>> sys.path['/home/jxj/TFFRCNN', '', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/PILcompat']>>> quit()jxj@ubuntu1:~/TFFRCNN$ jxj@ubuntu1:~/TFFRCNN$ pythonPython 2.7.12 (default, Nov 19 2016, 06:48:10) [GCC 5.4.0 20160609] on linux2Type "help", "copyright", "credits" or "license" for more information.>>> import sys>>> sys.path['', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/PILcompat']
Python环境变量的添加(修改PYTHONPATH变量)
jxj@ubuntu1:~/TFFRCNN$ export PYTHONPATH="/home/jxj/TFFRCNN:$PYTHONPATH"jxj@ubuntu1:~/TFFRCNN$ echo $PYTHONPATH/home/jxj/TFFRCNN:jxj@ubuntu1:~/TFFRCNN$ pythonPython 2.7.12 (default, Nov 19 2016, 06:48:10) [GCC 5.4.0 20160609] on linux2Type "help", "copyright", "credits" or "license" for more information.>>> import sys>>> sys.path['', '/home/jxj/TFFRCNN', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/PILcompat']>>> quit()
当终端关闭后,该环境变量也会失效。若要每次打开终端环境都能有效,将export PYTHONPATH=”/home/jxj/TFFRCNN:$PYTHONPATH” 添加至 ~/.bashrc 最后即可。
jxj@ubuntu1:~$ nl .bashrc | tail 87 # enable programmable completion features (you don't need to enable 88 # this, if it's already enabled in /etc/bash.bashrc and /etc/profile 89 # sources /etc/bash.bashrc). 90 if ! shopt -oq posix; then 91 if [ -f /usr/share/bash-completion/bash_completion ]; then 92 . /usr/share/bash-completion/bash_completion 93 elif [ -f /etc/bash_completion ]; then 94 . /etc/bash_completion 95 fi 96 fijxj@ubuntu1:~$ jxj@ubuntu1:~$ vim .bashrc jxj@ubuntu1:~$ jxj@ubuntu1:~$ nl .bashrc | tail 89 # sources /etc/bash.bashrc). 90 if ! shopt -oq posix; then 91 if [ -f /usr/share/bash-completion/bash_completion ]; then 92 . /usr/share/bash-completion/bash_completion 93 elif [ -f /etc/bash_completion ]; then 94 . /etc/bash_completion 95 fi 96 fi 97 export PYTHONPATH="/home/jxj/TFFRCNN:$PYTHONPATH"jxj@ubuntu1:~$ source .bashrc
阅读全文
0 0
- Linux中Python环境变量的设置
- linux中环境变量的设置
- linux中环境变量的设置
- linux设置python环境变量
- linux设置python环境变量
- python 设置linux环境变量
- linux python环境变量设置
- linux设置python环境变量
- linux中设置环境变量
- Linux中环境变量设置
- Linux中设置环境变量
- linux中设置环境变量
- python环境变量的设置
- 设置linux环境变量的3中方法
- Linux中设置环境变量的方法
- linux中设置环境变量的方法
- linux 中 export 设置环境变量的注意事项
- linux中对于PS1环境变量的设置
- 有关小波的几个术语及常见的小波基介绍
- import cv2问题(Anancoda与非Anaconda方式)
- 汇编第三节-寄存器(内存访问)
- jzoj P1592 音乐节拍
- 51nod 1255 字典序最小的子序列 贪心
- Linux中Python环境变量的设置
- File io 字节字符流
- C++ Primer 学习笔记(第六章)
- Zookeeper集群搭建和配置
- Delphi xe10开发常用资源(界面部分)
- 【Python Trick】set与list
- layer 弹窗 加载层 选择框
- Centos7安装Redis
- opencv3.3.0载入本地图片和网络图片新解