Tag: python

Python找不到存在的文件

Python(3.5)没有找到目录中的文件,我试图找出放在哪里的文件。 这是我得到的错误: Traceback (most recent call last): File “/home/rik/Pillow/faces.py”, line 35, in from PIL import Image File “/home/rik/Pillow/PIL/Image.py”, line 67, in from PIL import _imaging as core ImportError: cannot import name ‘_imaging’ 但我在/ home / rik / Pillow /文件夹中有一个名为’_imaging.c’的文件,我试着将它放在/ home / rik / Pillow / PIL /中,但没有运气。 我试图通过strace跟踪它在哪里获取文件,但是我收到了一个错误: rik@rik-MS-7971:~$ chmod +x /home/rik/Documents/tensorflow/tensorflow/examples/tutorials/mnist/mnist_with_summaries.py rik@rik-MS-7971:~$ strace -f […]

终端中的Geany输出

当我使用Python 3.5按下Geany上的运行按钮时,我在新的终端窗口中获​​得输出。 我想它应该与Preferences> Tools> Terminal连接,我写了xterm -e “/bin/sh %c” (遵循Geany手册 )。 有没有办法在消息窗口中查看Python代码输出?

导入meta Tracker内省的python绑定

当我尝试运行metaTracker内省示例或在iPython控制台中导入Tracker模块时,我收到导入错误。 谷歌搜索这个特定的错误消息除了在2012年为元跟踪器创建这些所谓的工作示例的补丁之外没有出现任何问题。 Python 2.7.4 (default, Apr 19 2013, 18:28:01) IPython 0.13 — An enhanced Interactive Python. In [1]: import gi In [2]: from gi.repository import Tracker, GObject ERROR:root:Could not find any typelib for Tracker ————————————————————————— ImportError Traceback (most recent call last) in () —-> 1 from gi.repository import Tracker, GObject ImportError: cannot import name Tracker […]

我不小心删除了/ usr / bin / python。 我该如何恢复它?

尝试将默认的Python版本设置为2.7,我运行了以下命令: sudo rm /usr/bin/python* 现在当我输入python或python2.7 ,我看到以下错误消息: bash: /usr/bin/python: No such file or directory bash: /usr/bin/python2.7: No such file or directory 发生了什么? 我应该运行rm命令吗? 我该怎么撤消它?

如何更改python的默认空闲?

好的,我的系统上有python 3.5。 每当我打开.py文件时,Idle3启动,因此按F5将立即运行我的代码。 但是我现在需要python 2.7进行分配。 在终端我安装’空闲’所以,我可以轻松地打开空闲和空闲3。 我的问题是,我无法将我的.py文件的默认应用程序更改为空闲。 它只看到idle3,所以我无法打开我的文件,默认情况下空闲(2.7)。 那有什么简单的解决方法吗?

Update Manager无法打开(与pythonverbose相关的错误)

我遇到了update-manager的问题。 昨晚,我的计算机在更新过程中突然重启。 现在它不会打开,它会一直显示在通知程序上,并显示一条消息,警告发生了错误。 当我尝试在终端上打开它时显示的错误相同: Error in sitecustomize; set PYTHONVERBOSE for traceback: EOFError: EOF read where not expected Traceback (most recent call last): File “/usr/bin/update-manager”, line 26, in from __future__ import print_function EOFError: EOF read where not expected 我已经在这里看到了一些问题,但是大多数都与ppas和source.list文件有关。 这似乎是更新管理器本身的一个错误。 我已经尝试删除它并重新安装,但问题仍然存在。 我还注意到另一个错误:我的源中心也没有打开。 它的消息类似于另一个消息: Error in sitecustomize; set PYTHONVERBOSE for traceback: EOFError: EOF read where not expected […]

Tkinter不工作

我最近从synaptic安装了Python和IDLE。 但是,当我测试Tkinter时,我收到以下错误: import Tkinter Tkinter._test() Traceback (most recent call last): File “”, line 1, in File “/usr/lib/python2.7/lib-tk/Tkinter.py”, line 3790, in _test root = Tk() File “/usr/lib/python2.7/lib-tk/Tkinter.py”, line 1767, in __init__ self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use) _tkinter.TclError: Can’t find a usable tk.tcl in the following directories: /usr/local/src/tcl8.6.1/library/tk8.6 /usr/local/src/tcl8.6.1/tk8.6 /usr/lib/tk8.6 /usr/local/lib/tk8.6 /lib/tk8.6 […]

pip3缺少依赖

我今天安装了最新的Ubuntu Gnome,并正在设置我的机器,用于与数据科学相关的工作。 当我尝试安装tensorflow-gpu时,我遇到了来自pip3的崩溃: me@pc:~/Desktop$ pip3 Traceback (most recent call last): File “/usr/lib/python3/dist-packages/pip/_vendor/__init__.py”, line 33, in vendored __import__(vendored_name, globals(), locals(), level=0) ImportError: No module named ‘pip._vendor.pkg_resources’ During handling of the above exception, another exception occurred: Traceback (most recent call last): File “/usr/bin/pip3”, line 9, in from pip import main File “/usr/lib/python3/dist-packages/pip/__init__.py”, line 13, in from pip.exceptions […]

如何从16.04的python 3连接到MySQL db

我按照本指南,以便我可以安装python 3的MySQL连接器。 https://stackoverflow.com/questions/43501080/how-to-connect-to-mysql-db-from-python-3-on-ubuntu-16 不幸的是,当我键入: (env) pip install mysqlclient Collecting mysqlclient Downloading mysqlclient-1.3.12.tar.gz (89kB) 100% |████████████████████████████████| 92kB 1.4MB/s Building wheels for collected packages: mysqlclient Running setup.py bdist_wheel for mysqlclient … error Complete output from command /home/hugh/SAT/env/bin/python3 -u -c “import setuptools, tokenize;__file__=’/tmp/pip-build-sbgaxask/mysqlclient/setup.py’;f=getattr(tokenize, ‘open’, open)(__file__);code=f.read().replace(‘\r\n’, ‘\n’);f.close();exec(compile(code, __file__, ‘exec’))” bdist_wheel -d /tmp/tmpqgsp3qwwpip-wheel- –python-tag cp35: running bdist_wheel running build running […]

为python2和python3构建matplotlib依赖项

我希望在我的计算机中有各种虚拟环境,其中一些运行python 2.7,另一些运行python3,其中一些必须具有完整的matplotlib支持,这是在创建虚拟环境时使用–system-syte-packages实现的(见matplotlib常见问题 )。 因此,我需要为两个python版本生成matplotlib的依赖项。 我开始时: sudo apt-get build-dep python-matplotlib 哪个安装正确,然后我试图运行: sudo apt-get build-dep python3-matplotlib 哪个什么都没做,它只打印了以下消息: Reading package lists… Done Picking ‘matplotlib’ as source package instead of ‘python3-matplotlib’ Reading package lists… Done Building dependency tree Reading state information… Done 0 to upgrade, 0 to newly install, 0 to remove and 6 not to upgrade. 怎么解决这个问题? 欢迎使用pip或apt-get相关解决方案。 […]