root@liqian-python:/pythonShare/monitor/m_server/core# python
Python 2.7.10 (default, Oct 14 2015, 16:09:02)
[GCC 5.2.1 20151010] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Could not open PYTHONSTARTUP
IOError: [Errno 2] No such file or directory: '/root/.pystartup'

解决方案:

1.创建文件并添加内容

vi /root/.pystartup

import sys
import readline
import rlcompleter
import atexit
import os
readline.parse_and_bind('tab: complete')
histfile =   os.path.join(os.environ['HOME'], '.pythonhistory')
try:
      readline.read_history_file(histfile)
except IOError:
      pass
atexit.register(readline.write_history_file, histfile)
del os, histfile, readline, rlcompleter
 
2.执行如下命令:

echo "export PYTHONSTARTUP=~/.pystartup" >> ~/.bashrc
source /root/.bashrc

再次进入python编辑器就不报错了!

 
 

python报错Could not open PYTHONSTARTUP的更多相关文章

  1. Python报错总结丶自定义报错

    Python报错总结: 常见异常 1,NameError: name 'a' is not defined:未定义函数名             2,IndentationError: uninden ...

  2. Python报错module 'scipy.misc' has no attribute 'xxx'

    Python报错module 'scipy.misc' has no attribute 'imresize' 解决办法: 安装Pillow包,命令如下: pip install Pillow 然后重 ...

  3. selenium python 报错“ unable to find binary in default location”

    selenium python 报错如下: raise exception_class(message, screen, stacktrace)selenium.common.exceptions.W ...

  4. 解决Python报错:local variable 'xxx' referenced before assignment(引)

    解决Python报错:local variable 'xxx' referenced before assignment(引) 解决Python报错:local variable 'xxx' refe ...

  5. python 报错 wxPyDeprecationWarning: Using deprecated class PySimpleApp.

    如题:python 报错 提示为 : wxPyDeprecationWarning: Using deprecated class PySimpleApp. 解决:将 wx.PySimpleApp() ...

  6. PyCharm 中文 字符 python 报错 的 完美 解决方案!

    PyCharm 中文 字符 python 报错 的 完美 解决方案! #_*_ coding:utf-8_*_ https://www.python.org/dev/peps/pep-0263/ 到p ...

  7. Python报错ModuleNotFoundError: No module named 'numpy'

    转载:https://blog.csdn.net/qq_39779233/article/details/103224712 Python报错ModuleNotFoundError: No modul ...

  8. Python报错UnicodeDecodeError: ascii codec can t decode byte 0xe0 ...解决方法

    用命令(python setup.py install)安装webpy时候总是报错 在网上搜索到的解决方法如下: 1. 这是Python 2 mimetypes的bug 2. 需要将Python2.7 ...

  9. 新手常见的python报错及解决方案

    此篇文章整理新手编写代码常见的一些错误,有些错误是粗心的错误,但对于新手而已,会折腾很长时间才搞定,所以在此总结下我遇到的一些问题.希望帮助到刚入门的朋友们.后续会不断补充. 目录 1.NameErr ...

随机推荐

  1. SQL注入浅水攻防

    啥是SQL注入(SQL Injection) 所谓SQL注入就是把SQL命令插入到表单的输入域或页面请求的查询字符串,欺骗服务器执行恶意的SQL命令.在某些表单中,用户输入的内容直接用来构造 (或影响 ...

  2. [每日一题] OCP1z0-047 :2013-07-22 group by 子句

    这道题就是考where group by having的顺序... 答案A不正确:where应该放在group by前面 答案B不正确:having子句是用多行函数(sum,avg,max,min,c ...

  3. How to install Savanna

    Pre-conditions: openstack has been installed successfully. 解压软件包中的savanna-all.tar.gz安装tar -C / -xzf ...

  4. Memcached 学习笔记(二)——ruby调用

    Memcached 学习笔记(二)——ruby调用 上一节我们讲述了怎样安装memcached及memcached常用命令.这一节我们将通过ruby来调用memcached相关操作. 第一步,安装ru ...

  5. 【Android LibGDX游戏引擎开发教程】第07期:中文字体的显示和绘制(上)

    在字体的显示和绘制中,Libgdx的作者(Mario Zechner,美国人)给我们提供了一个非常好用的工具 ——Hiero,那么下面就来看看它具体的使用方法. 一.Hiero工具的使用 1.Hier ...

  6. SharePoint Framework (SPFx)安装配置以及开发-基础篇

    前言 SharePoint Framework(SPFx),是页面 和Webpart的模型,完全支持本地开发(即完全可以脱离SharPoint环境在本地进行开发),SPFx包含了一系列的client- ...

  7. Grant简介以及安装

    Grant简介以及安装 1.   安装Grunt-cli需要使用npm,全局安装  命令:npm install –g grunt-cli(可能会涉及权限问题) 注意,安装grunt-cli并不等于安 ...

  8. Python第一天——入门Python(3)列表

    列表,也是一种序列类型. 如何定义列表? 用" [ ] "(中括号进行定义) 列表的索引操作 例如 # hobby_list=['basketball','football','p ...

  9. JS实现的在线推荐逻辑

    import _ from 'lodash';import cfg from '../cfg/cfg';import {Response} from '../shared/lib/response'; ...

  10. [SQL基础教程] 4-3 数据的更新(UPDATE)

    [SQL基础教程] C4 数据更新 4-3 数据的更新(UPDATE) UPDATE UPDATE <表名> SET <列名> = <表达式>; UPDATE &l ...