在SSH会话中运行时,Python程序无法正常工作

时间:2018-10-27 10:04:30

标签: python python-3.x tensorflow ssh pip

所以我有一个Python程序存储在远程服务器(运行Ubuntu Server 18.04)上。当我使用VNC Viewer远程控制服务器并在终端内(在该VNC会话中)运行python程序时,一切正常。

但是,当我创建SSH连接并尝试在本地计算机上的终端窗口中运行相同程序时,它将无法正常工作。

所以命令是这样的: python3 main.py --train

这是错误:

Unable to init server: Could not connect: Connection refused
Unable to init server: Could not connect: Connection refused

(main.py:24109): Gdk-CRITICAL **: 09:45:07.931: gdk_cursor_new_for_display: assertion 'GDK_IS_DISPLAY (display)' failed

(main.py:24109): Gdk-CRITICAL **: 09:45:07.932: gdk_cursor_new_for_display: assertion 'GDK_IS_DISPLAY (display)' failed
tf.estimator package not installed.
Traceback (most recent call last):
  File "main.py", line 8, in <module>
    from models import Model, DecoderType
  File "/home/kop/handwriting/src/models.py", line 3, in <module>
    from md_lstm import multi_dimensional_rnn_while_loop
  File "/home/kop/handwriting/src/md_lstm.py", line 2, in <module>
    from tensorflow.contrib.rnn import RNNCell, LSTMStateTuple
  File "/home/kop/.local/lib/python3.6/site-packages/tensorflow/contrib/__init__.py", line 39, in <module>
    from tensorflow.contrib import distribute
  File "/home/kop/.local/lib/python3.6/site-packages/tensorflow/contrib/distribute/__init__.py", line 27, in <module>
    from tensorflow.contrib.distribute.python.tpu_strategy import TPUStrategy
  File "/home/kop/.local/lib/python3.6/site-packages/tensorflow/contrib/distribute/python/tpu_strategy.py", line 24, in <module>
    from tensorflow.contrib import tpu
  File "/home/kop/.local/lib/python3.6/site-packages/tensorflow/contrib/tpu/__init__.py", line 64, in <module>
    from tensorflow.contrib.tpu.python.tpu.keras_support import tpu_model as keras_to_tpu_model
  File "/home/kop/.local/lib/python3.6/site-packages/tensorflow/contrib/tpu/python/tpu/keras_support.py", line 67, in <module>
    from tensorflow.python.estimator import model_fn as model_fn_lib
  File "/home/kop/.local/lib/python3.6/site-packages/tensorflow/python/estimator/__init__.py", line 25, in <module>
    import tensorflow.python.estimator.estimator_lib
  File "/home/kop/.local/lib/python3.6/site-packages/tensorflow/python/estimator/estimator_lib.py", line 41, in <module>
    from tensorflow.python.estimator.inputs import inputs
  File "/home/kop/.local/lib/python3.6/site-packages/tensorflow/python/estimator/inputs/inputs.py", line 22, in <module>
    from tensorflow.python.estimator.inputs.numpy_io import numpy_input_fn
  File "/home/kop/.local/lib/python3.6/site-packages/tensorflow/python/estimator/inputs/numpy_io.py", line 26, in <module>
    from tensorflow.python.estimator.inputs.queues import feeding_functions
  File "/home/kop/.local/lib/python3.6/site-packages/tensorflow/python/estimator/inputs/queues/feeding_functions.py", line 40, in <module>
    import pandas as pd
  File "/home/kop/.local/lib/python3.6/site-packages/pandas/__init__.py", line 50, in <module>
    plot_params = pandas.plotting._style._Options(deprecated=True)
AttributeError: module 'pandas' has no attribute 'plotting'

我试图在我的SSH会话中重新运行pip install某些软件包,但不能解决问题。

我还尝试运行python3并尝试导入tensorflowpandas,我认为这将是问题的根源,并且仍然可以导入该软件包:

lol i can import those packages and it said it can't find it ???

因此,我认为这些软件包的PATH可能存在一些错误,因此我无法运行该程序,但是我不知道如何解决该问题,而且我也找不到互联网上与我的问题有关的任何事情……所以我真的需要你们的帮助。

请记住,我远程控制时使用的用户和使用 SSH连接时用户的< / strong>是相同用户

非常感谢您的帮助。

0 个答案:

没有答案