python3은 python2.7.6을 가리킵니다.

python3은 python2.7.6을 가리킵니다.

제가 충분히 주의를 기울이지 않았을 때 가상 환경을 통과하려고 하다가 Python 설치를 엉망으로 만든 것 같습니다.

python3 --version
Python 2.7.6

하지만 쓰레기통을 확인해 보면 상황이 어떤지 잘 모르겠습니다.

ls -lah /usr/bin/python3
lrwxrwxrwx 1 root root 9 Sep 21  2015 /usr/bin/python3 -> python3.4

이런 일이 발생하면 apt를 올바르게 사용할 수 없기 때문에 이것은 나를 미치게 만듭니다. 잘못된 해석기를 사용하고 있기 때문에 ASCII 오류가 발생합니다.

나는 pyvenv나 venv를 망쳤다고 확신하지만 무엇인지는 잘 모르겠습니다. 돕다?

글쎄, 나는 그것을 실행했고 dpkg -C절반만 컴파일된 패키지를 얻었습니다. 주로 python3 패키지를 제거하고 다시 설치해 보았습니다. dpkg --configure를 실행했는데 다음 오류가 발생했습니다.

Setting up python3-gi (3.12.0-1ubuntu1) ...
File "/usr/bin/py3compile", line 4
SyntaxError: Non-ASCII character '\xc2' in file /usr/bin/py3compile on line 4, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details
dpkg: error processing package python3-gi (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 python3-gi

내 생각에 이 오류는 다른 패키지를 설치하려고 할 때 나타나기 때문에 이전에도 나타났지만 스택 추적에서는 더 뒤로 돌아왔습니다.

가득한 dpkg -C:

The following packages are only half configured, probably due to problems
configuring them the first time.  The configuration should be retried using
dpkg --configure <package> or the configure menu option in dselect:
 python3-aptdaemon.pkcompat PackageKit compatibilty for AptDaemon
 python3-aptdaemon.gtk3widgets Python 3 GTK+ 3 widgets to run an aptdaemon clie
 python3-dbus         simple interprocess messaging system (Python 3 interface)
 python3-uno          Python-UNO bridge
 python3-reportlab    ReportLab library to create PDF documents using Python3
 mugshot              lightweight user-configuration application
 python3-pycurl       Python 3 bindings to libcurl
 python3-aptdaemon    Python 3 module for the server and client of aptdaemon
 python3-setuptools   Python3 Distutils Enhancements
 catfish              File searching tool which is configurable via the command
 lsb-release          Linux Standard Base version reporting utility
 python3-speechd      Python interface to Speech Dispatcher
 python3-gi           Python 3 bindings for gobject-introspection libraries
 python3-xdg          Python 3 library to access freedesktop.org standards
 gdebi-core           simple tool to install deb files
 python3-pexpect      Python 3 module for automating interactive applications
 python3-requests     elegant and simple HTTP library for Python3, built for hu
 python3-crypto       cryptographic algorithms and protocols for Python 3
 menulibre            advanced FreeDesktop.org compliant menu editor
 python3-louis        Python bindings for liblouis
 nvidia-352           NVIDIA binary driver - version 352.79
 python3-colorama     Cross-platform colored terminal text in Python - Python 3
 python3-pyatspi      Assistive Technology Service Provider Interface - Python3
 python3-piston-mini-client library for writing clients for Django's Piston RES
 python3-oneconf      synchronize your configuration data over the network (Pyt
 python3-defer        Small framework for asynchronous programming (Python 3)
 python3-commandnotfound Python 3 bindings for command-not-found.
 python3-distlib      low-level components of python distutils2/packaging
 python3-chardet      universal character encoding detector for Python3
 python3-lxml         pythonic binding for the libxml2 and libxslt libraries
 blender              Very fast and versatile 3D modeller/renderer
 ufw                  program for managing a Netfilter firewall
 python3-cairo        Python 3 bindings for the Cairo vector graphics library
 apt-clone            Script to create state bundles
 python3-dirspec      Python User Folders Specification Library
 thin-client-config-agent Retrieve the list of remote desktop servers for a use
 python3-psutil       module providing convenience functions for managing proce
 gdebi                simple tool to install deb files - GNOME GUI
 python3-icu          Python 3 extension wrapping the ICU C++ API
 screen-resolution-extra Extension for the GNOME screen resolution applet
 python3-httplib2     comprehensive HTTP client library written for Python3
 python3-six          Python 2 and 3 compatibility library (Python 3 interface)
 python3-pkg-resources Package Discovery and Resource Access using pkg_resource
 ubuntu-drivers-common Detect and install additional Ubuntu driver packages
 hplip-data           HP Linux Printing and Imaging - data files
 python3-html5lib     HTML parser/tokenizer based on the WHATWG HTML5 specifica
 python3-oauthlib     generic, spec-compliant implementation of OAuth for Pytho
 python3-pil          Python Imaging Library (Python3)
 python3-pip          alternative Python package installer - Python 3 version o
 language-selector-common Language selector for Ubuntu
 python3-xkit         library for the manipulation of xorg.conf files (Python 3
 python3-urllib3      HTTP library with thread-safe connection pooling for Pyth

그런 다음

which python3

반품

/usr/bin/python3

그리고

dpkg -S /usr/bin/python3
python3-minimal: /usr/bin/python3

아하! 그런데 이것이 무엇을 의미하는가?

dpkg -l python3-minimal
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name           Version      Architecture Description
+++-==============-============-============-=================================
ri  python3-minima 3.4.0-0ubunt amd64        minimal subset of the Python lang

재설치를 시도했지만 오류가 발생한 다음 dpkg를 사용하여 구성을 시도했습니다.

sudo dpkg --configure python3-minimal
Setting up python3-minimal (3.4.0-0ubuntu2) ...
/var/lib/dpkg/info/python3-minimal.postinst: 5: /var/lib/dpkg/info/python3-minimal.postinst: py3compile: not found
dpkg: error processing package python3-minimal (--configure):
 subprocess installed post-installation script returned error exit status 127
Errors were encountered while processing:
 python3-minimal

답변1

모든 것을 되돌아보니 문제는 가상 환경에서 생성된 bin 디렉터리가 실제로 내 루트 bin 디렉터리에 대한 심볼릭 링크를 생성했다는 것이었습니다.

마지막으로 다른 운영 체제를 설치하고 백업에서 문서를 로드했습니다.

관련 정보