انجمنهای فارسی اوبونتو
تازه کار => انجمن تازهکاران => نویسنده: s_g در 07 تیر 1397، 11:40 قظ
-
سلام
برای من دو ارور موقع آپدیت کردن پایتون به وجود اومده که نمی تونم خود ارورها رو رفع کنم. و موقع آپدیت کردن اوبونتو به ورژن ۱۸.۰۴ هم همون ارور رو دقیقا بهم می ده. به علاوه علامت ممنوع هم در بالای صفحه سمت راست دارم. ممنون می شم اگر کسی برای رفع این ارور بهم راهنمایی برسونه.
File "/usr/bin/gnome-terminal", line 9, in <module>
from gi.repository import GLib, Gio
File "/usr/lib/python3/dist-packages/gi/__init__.py", line 42, in <module>
from . import _gi
ImportError: cannot import name '_gi'
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
from apport.fileutils import likely_packaged, get_recent_crashes
File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
from apport.report import Report
File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in <module>
import apport.fileutils
File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in <module>
from apport.packaging_impl import impl as packaging
File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 24, in <module>
import apt
File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in <module>
import apt_pkg
ImportError: No module named 'apt_pkg'
Original exception was:
Traceback (most recent call last):
File "/usr/bin/gnome-terminal", line 9, in <module>
from gi.repository import GLib, Gio
File "/usr/lib/python3/dist-packages/gi/__init__.py", line 42, in <module>
from . import _gi
ImportError: cannot import name '_gi'
-
سلام
لطفاً کامل توضیح بدین شما دقیقاً چیکار کردین ؟ منظورتون از آپدیت پایتون چی هستش ؟ مثلاً آناکوندا رو نصب کردین یا پایتون رو با ppa نصب کردین ؟ یا چی ؟
نحوه ی انجامش رو هم توضیح بدین که چطوری این کار رو کردین
پ.ن:لطفاً خروجی این دستور رو هم بذارین :
ls -alF /usr/bin/python3 /usr/bin/python
-
اروری رو که در پست قبلی گفتم با دستور
gnome-terminal
و دستور آپدیت کردن ابونتو رو با دستور
sudo do-release-upgrade -d
که هر دو دستور نتیجه اش اون دو ارور هست.
در مورد آپدیت حقیقتش یادم نیست دقیقا چی کار کردم (تازه دارم با ابونتو کار می کنم) ولی روشش رو یادمه که یه سایتی نوشته بود اول باید مخازن رو آپدیت کنیم و بعد از اون پایتون ورژن جدید(با اسم python3) رو نصب کنیم و به جای قبلی اکتیو کنیم. از کد همون هم استفاده کردم.
-
اوکی پس شما خروجی دستوری رو که دادم رو بدین تا بشه حدس زد مشکل از کجاست :
ls -alF /usr/bin/python3 /usr/bin/python
-
lrwxrwxrwx 1 root root 9 Sep 23 2017 /usr/bin/python -> python2.7*
lrwxrwxrwx 1 root root 9 Jun 27 09:32 /usr/bin/python3 -> python3.5*
-
مشکل به نظرم از آپدیت کردن هست چون اون علامت ممنوع بالای صفحه رو که باز می کنم نوشته
a problem occurred when checking for the updates.
-
خروجی این دستورات رو هم بذارین :
whereis python3
python3 -m apt_pkg
-
whereis python3
python3: /usr/bin/python3.5 /usr/bin/python3.6 /usr/bin/python3 /usr/bin/python3.6m /usr/bin/python3.5m /usr/lib/python3.5 /usr/lib/python3.6 /usr/lib/python3 /usr/lib/python3.7 /etc/python3.5 /etc/python3.6 /etc/python3 /usr/local/bin/python3.6m-config /usr/local/bin/python3.6 /usr/local/bin/python3.6m /usr/local/lib/python3.5 /usr/local/lib/python3.6 /usr/include/python3.6m /usr/share/python3 /usr/share/man/man1/python3.1.gz
/usr/bin/python3: No module named apt_pkg
-
حدس می زنم شما از طریق ppa پایتون 3.6 رو نصب کردین و بعدش دوباره پایتون 3.5 رو ست کردین ولی این کار کامل انجام نشده.
شما خروجی این رو بذارین تا بفهمیم کدوم نسخه های پایتون خارج از مخازن نصب شده :
dpkg -l | grep python
apt policy python3
apt policy python3.6
-
ii dh-python 2.20170125 all Debian helper tools for packaging Python libraries and applications
ii idle-python3.6 3.6.3-1ubuntu1 all IDE for Python (v3.6) using Tkinter
ii libpython-stdlib:amd64 2.7.14-2ubuntu1 amd64 interactive high-level object-oriented language (default python version)
ii libpython2.7:amd64 2.7.14-2ubuntu2 amd64 Shared Python runtime library (version 2.7)
ii libpython2.7-minimal:amd64 2.7.14-2ubuntu2 amd64 Minimal subset of the Python language (version 2.7)
ii libpython2.7-stdlib:amd64 2.7.14-2ubuntu2 amd64 Interactive high-level object-oriented language (standard library, version 2.7)
ii libpython3-stdlib:amd64 3.6.3-0ubuntu2 amd64 interactive high-level object-oriented language (default python3 version)
ii libpython3.5-minimal:amd64 3.5.3-1 amd64 Minimal subset of the Python language (version 3.5)
ii libpython3.5-stdlib:amd64 3.5.3-1 amd64 Interactive high-level object-oriented language (standard library, version 3.5)
ii libpython3.6:amd64 3.6.3-1ubuntu1 amd64 Shared Python runtime library (version 3.6)
ii libpython3.6-minimal:amd64 3.6.3-1ubuntu1 amd64 Minimal subset of the Python language (version 3.6)
ii libpython3.6-stdlib:amd64 3.6.3-1ubuntu1 amd64 Interactive high-level object-oriented language (standard library, version 3.6)
ii python 2.7.14-2ubuntu1 amd64 interactive high-level object-oriented language (default version)
ii python-apt-common 1.4.0~beta3build2 all Python interface to libapt-pkg (locales)
ii python-argcomplete 1.8.1-1ubuntu1 all bash tab completion for argparse
ii python-argh 0.26.2-1 all simple argparse wrapper (Python 2)
ii python-asn1crypto 0.22.0-1 all Fast ASN.1 parser and serializer (Python 2)
ii python-blessings 1.6-2build1 all simple but powerful module to manage terminal color and styling (Python 2)
ii python-certifi 2017.4.17-2 all root certificates for validating SSL certs and verifying TLS hosts
ii python-cffi-backend 1.9.1-2build2 amd64 Foreign Function Interface for Python calling C code - backend
ii python-chardet 3.0.4-1 all universal character encoding detector for Python2
ii python-cryptography 1.9-1 amd64 Python library exposing cryptographic recipes and primitives (Python 2)
ii python-curtsies 0.2.11-1 all library for terminal interaction (Python 2)
ii python-enum34 1.1.6-1 all backport of Python 3.4's enum package
ii python-greenlet 0.4.11-1build2 amd64 Lightweight in-process concurrent programming
ii python-idna 2.5-1 all Python IDNA2008 (RFC 5891) handling (Python 2)
ii python-ipaddress 1.0.17-1 all Backport of Python 3 ipaddress module (Python 2)
ii python-minimal 2.7.14-2ubuntu1 amd64 minimal subset of the Python language (default version)
ii python-openssl 16.2.0-1 all Python 2 wrapper around the OpenSSL library
ii python-pathtools 0.1.2-2 all Path utilities for Python - Python 2.x
ii python-pkg-resources 36.2.7-2 all Package Discovery and Resource Access using pkg_resources
ii python-pygments 2.2.0+dfsg-1 all syntax highlighting package written in Python
ii python-requests 2.18.1-1 all elegant and simple HTTP library for Python2, built for human beings
ii python-six 1.10.0-4 all Python 2 and 3 compatibility library (Python 2 interface)
ii python-talloc 2.1.9-2ubuntu1 amd64 hierarchical pool based memory allocator - Python bindings
ii python-urllib3 1.21.1-1 all HTTP library with thread-safe connection pooling for Python
ii python-urwid 1.3.1-2ubuntu2 amd64 curses-based UI/widget library for Python 2
ii python-watchdog 0.8.3-2 all Python API and shell utilities to monitor file system events - Python 2.x
ii python-wcwidth 0.1.7+dfsg1-1 all determine printable width of a string on a terminal (Python 2)
ii python-yaml 3.12-1build2 amd64 YAML parser and emitter for Python
ii python2.7 2.7.14-2ubuntu2 amd64 Interactive high-level object-oriented language (version 2.7)
ii python2.7-minimal 2.7.14-2ubuntu2 amd64 Minimal subset of the Python language (version 2.7)
ii python3 3.6.3-0ubuntu2 amd64 interactive high-level object-oriented language (default python3 version)
ii python3-apport 2.20.7-0ubuntu3.9 all Python 3 library for Apport crash report handling
ii python3-apt 1.4.0~beta3build2 amd64 Python 3 interface to libapt-pkg
ii python3-aptdaemon 1.1.1+bzr982-0ubuntu17.1 all Python 3 module for the server and client of aptdaemon
ii python3-aptdaemon.gtk3widgets 1.1.1+bzr982-0ubuntu17.1 all Python 3 GTK+ 3 widgets to run an aptdaemon client
ii python3-argcomplete 1.8.1-1ubuntu1 all bash tab completion for argparse (for Python 3)
ii python3-argh 0.26.2-1 all simple argparse wrapper (Python 3)
ii python3-asn1crypto 0.22.0-1 all Fast ASN.1 parser and serializer (Python 3)
ii python3-blessings 1.6-2build1 all simple but powerful module to manage terminal color and styling (Python 3)
ii python3-blinker 1.3.dfsg2-1build1 all fast, simple object-to-object and broadcast signaling library
ii python3-brlapi 5.4-7ubuntu4 amd64 Braille display access via BRLTTY - Python3 bindings
ii python3-bs4 4.6.0-1 all error-tolerant HTML parser for Python 3
ii python3-cairo 1.10.0+dfsg-5build3 amd64 Python 3 bindings for the Cairo vector graphics library
ii python3-certifi 2017.4.17-2 all root certificates for validating SSL certs and verifying TLS hosts (python3)
ii python3-cffi-backend 1.9.1-2build2 amd64 Foreign Function Interface for Python 3 calling C code - runtime
ii python3-chardet 3.0.4-1 all universal character encoding detector for Python3
ii python3-commandnotfound 0.3ubuntu17.10.2 all Python 3 bindings for command-not-found.
ii python3-crypto 2.6.1-7ubuntu0.1 amd64 cryptographic algorithms and protocols for Python 3
ii python3-cryptography 1.9-1 amd64 Python library exposing cryptographic recipes and primitives (Python 3)
ii python3-cups 1.9.73-1build2 amd64 Python3 bindings for CUPS
ii python3-cupshelpers 1.5.9+20170825-0ubuntu1 all Python utility modules around the CUPS printing system
ii python3-curtsies 0.2.11-1 all library for terminal interaction (Python 3)
ii python3-dbus 1.2.4-1build3 amd64 simple interprocess messaging system (Python 3 interface)
ii python3-debian 0.1.30 all Python 3 modules to work with Debian-related data formats
ii python3-defer 1.0.6-2build1 all Small framework for asynchronous programming (Python 3)
ii python3-distro-info 0.17 all information about distributions' releases (Python 3 module)
ii python3-distupgrade 1:17.10.11 all manage release upgrades
ii python3-feedparser 5.1.3-3build1 all Universal Feed Parser for Python 3
ii python3-gdbm:amd64 3.6.3-0ubuntu1 amd64 GNU dbm database support for Python 3.x
ii python3-gi 3.24.1-2build1 amd64 Python 3 bindings for gobject-introspection libraries
ii python3-gi-cairo 3.24.1-2build1 amd64 Python 3 Cairo bindings for the GObject library
ii python3-greenlet 0.4.11-1build2 amd64 Lightweight in-process concurrent programming (python3)
ii python3-html5lib 0.999999999-1 all HTML parser/tokenizer based on the WHATWG HTML5 specification
ii python3-httplib2 0.9.2+dfsg-1 all comprehensive HTTP client library written for Python3
ii python3-idna 2.5-1 all Python IDNA2008 (RFC 5891) handling (Python 3)
ii python3-jwt 1.4.2-1.1 all Python 3 implementation of JSON Web Token
ii python3-keyring 10.4.0-1 all store and access your passwords safely - Python 3 version of the package
ii python3-keyrings.alt 2.2-2 all alternate backend implementations for python3-keyring
ii python3-launchpadlib 1.10.5-1 all Launchpad web services client library (Python 3)
ii python3-lazr.restfulclient 0.13.5-1 all client for lazr.restful-based web services (Python 3)
ii python3-lazr.uri 1.0.3-2build1 all library for parsing, manipulating, and generating URIs
ii python3-louis 3.0.0-3ubuntu1.2 all Python bindings for liblouis
ii python3-lxml 4.0.0-1 amd64 pythonic binding for the libxml2 and libxslt libraries
ii python3-mako 1.0.7+ds1-1 all fast and lightweight templating for the Python 3 platform
ii python3-markupsafe 1.0-1build1 amd64 HTML/XHTML/XML string library for Python 3
ii python3-minimal 3.6.3-0ubuntu2 amd64 minimal subset of the Python language (default python3 version)
ii python3-oauth 1.0.1-5 all Python 3 library implementing of the OAuth protocol
ii python3-oauthlib 2.0.1-1 all generic, spec-compliant implementation of OAuth for Python3
ii python3-olefile 0.44-1 all Python module to read/write MS OLE2 files
ii python3-pathtools 0.1.2-2 all Path utilities for Python - Python 3.x
ii python3-pexpect 4.2.1-1 all Python 3 module for automating interactive applications
ii python3-pil:amd64 4.1.1-3build2 amd64 Python Imaging Library (Python3)
ii python3-pkg-resources 36.2.7-2 all Package Discovery and Resource Access using pkg_resources
ii python3-problem-report 2.20.7-0ubuntu3.9 all Python 3 library to handle problem reports
ii python3-ptyprocess 0.5.2-1 all Run a subprocess in a pseudo terminal from Python 3
ii python3-pyatspi 2.24.0+dfsg-1 all Assistive Technology Service Provider Interface - Python3 bindings
ii python3-pygments 2.2.0+dfsg-1 all syntax highlighting package written in Python 3
ii python3-renderpm:amd64 3.4.0-3build1 amd64 python low level render interface
ii python3-reportlab 3.4.0-3build1 all ReportLab library to create PDF documents using Python3
ii python3-reportlab-accel:amd64 3.4.0-3build1 amd64 C coded extension accelerator for the ReportLab Toolkit
ii python3-requests 2.18.1-1 all elegant and simple HTTP library for Python3, built for human beings
ii python3-secretstorage 2.3.1-2 all Python module for storing secrets - Python 3.x version
ii python3-setuptools 36.2.7-2 all Python3 Distutils Enhancements
ii python3-simplejson 3.11.1-1build1 amd64 simple, fast, extensible JSON encoder/decoder for Python 3.x
ii python3-six 1.10.0-4 all Python 2 and 3 compatibility library (Python 3 interface)
ii python3-software-properties 0.96.24.17 all manage the repositories that you install software from
ii python3-speechd 0.8.7-1 all Python interface to Speech Dispatcher
ii python3-systemd 234-1build1 amd64 Python 3 bindings for systemd
ii python3-tk:amd64 3.6.3-0ubuntu1 amd64 Tkinter - Writing Tk applications with Python 3.x
ii python3-uno 1:5.4.6-0ubuntu0.17.10.1 amd64 Python-UNO bridge
ii python3-update-manager 1:17.10.14 all python 3.x module for update-manager
ii python3-urllib3 1.21.1-1 all HTTP library with thread-safe connection pooling for Python3
ii python3-wadllib 1.3.2-3 all Python 3 library for navigating WADL files
ii python3-watchdog 0.8.3-2 all Python API and shell utilities to monitor file system events - Python 3.x
ii python3-wcwidth 0.1.7+dfsg1-1 all determine printable width of a string on a terminal (Python 3)
ii python3-webencodings 0.5-2 all Python implementation of the WHATWG Encoding standard
ii python3-xdg 0.25-4 all Python 3 library to access freedesktop.org standards
ii python3-xkit 0.5.0ubuntu2 all library for the manipulation of xorg.conf files (Python 3)
ii python3-yaml 3.12-1build2 amd64 YAML parser and emitter for Python3
ii python3-zope.interface 4.3.2-1build2 amd64 Interfaces for Python3
ii python3.5 3.5.3-1 amd64 Interactive high-level object-oriented language (version 3.5)
ii python3.5-minimal 3.5.3-1 amd64 Minimal subset of the Python language (version 3.5)
ii python3.6 3.6.3-1ubuntu1 amd64 Interactive high-level object-oriented language (version 3.6)
ii python3.6-minimal 3.6.3-1ubuntu1 amd64 Minimal subset of the Python language (version 3.6)
-
python3:
Installed: 3.6.3-0ubuntu2
Candidate: 3.6.3-0ubuntu2
Version table:
*** 3.6.3-0ubuntu2 500
500 http://us.archive.ubuntu.com/ubuntu artful/main amd64 Packages
100 /var/lib/dpkg/status
-
python3.6:
Installed: 3.6.3-1ubuntu1
Candidate: 3.6.3-1ubuntu1
Version table:
*** 3.6.3-1ubuntu1 500
500 http://us.archive.ubuntu.com/ubuntu artful/main amd64 Packages
100 /var/lib/dpkg/status
-
خب بعد از گرفتن خروجی از شما نوبت به راه حل می رسه ...
شما از نسخه 17.10 اوبونتو استفاده می کنین که پایتون پیش فرض اون 3.6 هسش.
ولی شما با دستکاری که انجام دادین پایتون پیش فرض رو به 3.5 تغییر دادین.
که همین قضیه باعث شده ماژول هایی عین gi و apt_pkg رو نتونین توی پایتون 3 (که به پایتون 3.5 لینک شده) لود کنین.
پس برای حل مشکل شما به نظر می رسه برگردوندن به حالت اصلی مشکلتون رو حل می کنه و برای اینکار این دستورات رو اجرا کنین :
sudo rm /usr/bin/python3
sudo ln -s python3.6 /usr/bin/python3
حالا تست کنین ببینین مثلا gnome-terminal رو می تونین اجرا کنین یا نه
-
وارنینگ داد
gnome-terminal
Warning: DESKTOP_STARTUP_ID not set and no fallback available.
-
اون علامت ممنوع بالای صفحه رفت و برخی مشکل های دیگه رفع شد. خیلی ممنونم.
-
نشست شما Wayland هستش یا Xorg ؟
اگه Wayland باشه طبیعیه و این هشدار مشکلی نداره (در کل هم مشکلی نداره).
الان ترمینال باز می شه برای شما ؟ می تونین سیستم رو آپگرید کنین ؟ اگه می تونین مشکل شما حل شده نگران هشدارها نباشین.
-
البته اون علامت ممنوع بالای صفحه رفت و برخی مشکل های دیگه رفع شد. خیلی ممنونم
خواهش می کنم
اگه مشکلتون حل شد عبارت (حل شد) رو به عنوان اضافه کنین.