0%

Environment

1
2
3
Python:2.7.13
Pip:9.0.1
matplotlib:2.0.0 (pip install matplotlib)

Error Message

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
>>> import matplotlib.pyplot
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/soft/python2/lib/python2.7/site-packages/matplotlib/pyplot.py", line 115, in <module>
_backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
File "/opt/soft/python2/lib/python2.7/site-packages/matplotlib/backends/__init__.py", line 32, in pylab_setup
globals(),locals(),[backend_name],0)
File "/opt/soft/python2/lib/python2.7/site-packages/matplotlib/backends/backend_tkagg.py", line 6, in <module>
from six.moves import tkinter as Tk
File "/opt/soft/python2/lib/python2.7/site-packages/six.py", line 203, in load_module
mod = mod._resolve()
File "/opt/soft/python2/lib/python2.7/site-packages/six.py", line 115, in _resolve
return _import_module(self.mod)
File "/opt/soft/python2/lib/python2.7/site-packages/six.py", line 82, in _import_module
__import__(name)
File "/opt/soft/python2/lib/python2.7/lib-tk/Tkinter.py", line 39, in <module>
import _tkinter # If this fails your Python may not be configured for Tk
ImportError: No module named _tkinter
阅读全文 »

Linux Python2 Tab Autocomplete

① 新建 vim ~/.pystartup Python2 启动时的环境变量加载文件。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# Add auto-completion and a stored history file of commands to your Python
# interactive interpreter. Requires Python 2.0+, readline. Autocomplete is
# bound to the Esc key by default (you can change it - see readline docs).
#
# Store the file in ~/.pystartup, and set an environment variable to point
# to it: "export PYTHONSTARTUP=~/.pystartup" in bash.
import atexit
import os
import readline
import rlcompleter
readline.parse_and_bind('tab: complete')
historyPath = os.path.expanduser("~/.pyhistory")
def save_history(historyPath=historyPath):
import readline
readline.write_history_file(historyPath)
if os.path.exists(historyPath):
readline.read_history_file(historyPath)
atexit.register(save_history)
del os, atexit, readline, rlcompleter, save_history, historyPath
阅读全文 »

实验环境

本文用 Vmware Workstation 模拟出来的一个VPN环境,其中主机参数如下:

1
2
3
4
5
6
7
8
# 任意的WEB服务
LAN WEB SERVER 10.1.1.11

# Centos 6.X(Openvpn 2.3.X)
VPN SERVER 10.1.1.10(LAN) 10.1.2.10(WAN)

# Windows 7 (Openvpn Client)
WAN Client PC 10.1.2.11
阅读全文 »