반응형
어렵고 복잡하지만 아래 실행 메시지를 따라서 실행했는데 결과는 조금~ 출처는 이곳.
두 부분으로 되어 있는데 윗 부분을 끝까지 따라하고 두 번째는 요약인데 다시 실행한다. 폰트 사이즈가 작은 것도 좀 문제이긴 하고...
gi@RPI5GI:~ $ sudo rm /usr/lib/python3.11/EXTERNALLY-MANAGED
gi@RPI5GI:~ $ sudo apt-get install python-Adafruit-GPIO
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package python-Adafruit-GPIO
gi@RPI5GI:~ $ sudo apt-get install python3-Adafruit-GPIO
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package python3-Adafruit-GPIO
gi@RPI5GI:~ $ pip install Adafruit-GPIO
Defaulting to user installation because normal site-packages is not writeable
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting Adafruit-GPIO
Downloading https://www.piwheels.org/simple/adafruit-gpio/Adafruit_GPIO-1.0.3-py3-none-any.whl (38 kB)
Collecting adafruit-pureio
Downloading https://www.piwheels.org/simple/adafruit-pureio/Adafruit_PureIO-1.1.11-py3-none-any.whl (10 kB)
Requirement already satisfied: spidev in /usr/lib/python3/dist-packages (from Adafruit-GPIO) (3.5)
Installing collected packages: adafruit-pureio, Adafruit-GPIO
Successfully installed Adafruit-GPIO-1.0.3 adafruit-pureio-1.1.11
gi@RPI5GI:~ $ python3 oled_test.py
python3: can't open file '/home/gi/oled_test.py': [Errno 2] No such file or directory
gi@RPI5GI:~ $ python3 /home/gi/raspi-blinka.py
python3: can't open file '/home/gi/raspi-blinka.py': [Errno 2] No such file or directory
gi@RPI5GI:~ $ cd
gi@RPI5GI:~ $ cd Adafruit_Python_SSD1306
gi@RPI5GI:~/Adafruit_Python_SSD1306 $ sudo python3 setup.py install
running install
/usr/lib/python3/dist-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
/usr/lib/python3/dist-packages/setuptools/command/easy_install.py:146: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
running bdist_egg
running egg_info
writing Adafruit_SSD1306.egg-info/PKG-INFO
writing dependency_links to Adafruit_SSD1306.egg-info/dependency_links.txt
writing requirements to Adafruit_SSD1306.egg-info/requires.txt
writing top-level names to Adafruit_SSD1306.egg-info/top_level.txt
reading manifest file 'Adafruit_SSD1306.egg-info/SOURCES.txt'
adding license file 'LICENSE'
writing manifest file 'Adafruit_SSD1306.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-aarch64/egg
running install_lib
running build_py
creating build/bdist.linux-aarch64/egg
creating build/bdist.linux-aarch64/egg/Adafruit_SSD1306
copying build/lib/Adafruit_SSD1306/__init__.py -> build/bdist.linux-aarch64/egg/Adafruit_SSD1306
copying build/lib/Adafruit_SSD1306/SSD1306.py -> build/bdist.linux-aarch64/egg/Adafruit_SSD1306
byte-compiling build/bdist.linux-aarch64/egg/Adafruit_SSD1306/__init__.py to __init__.cpython-311.pyc
byte-compiling build/bdist.linux-aarch64/egg/Adafruit_SSD1306/SSD1306.py to SSD1306.cpython-311.pyc
creating build/bdist.linux-aarch64/egg/EGG-INFO
copying Adafruit_SSD1306.egg-info/PKG-INFO -> build/bdist.linux-aarch64/egg/EGG-INFO
copying Adafruit_SSD1306.egg-info/SOURCES.txt -> build/bdist.linux-aarch64/egg/EGG-INFO
copying Adafruit_SSD1306.egg-info/dependency_links.txt -> build/bdist.linux-aarch64/egg/EGG-INFO
copying Adafruit_SSD1306.egg-info/requires.txt -> build/bdist.linux-aarch64/egg/EGG-INFO
copying Adafruit_SSD1306.egg-info/top_level.txt -> build/bdist.linux-aarch64/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents...
creating 'dist/Adafruit_SSD1306-1.6.2-py3.11.egg' and adding 'build/bdist.linux-aarch64/egg' to it
removing 'build/bdist.linux-aarch64/egg' (and everything under it)
Processing Adafruit_SSD1306-1.6.2-py3.11.egg
Removing /usr/local/lib/python3.11/dist-packages/Adafruit_SSD1306-1.6.2-py3.11.egg
Copying Adafruit_SSD1306-1.6.2-py3.11.egg to /usr/local/lib/python3.11/dist-packages
Adafruit-SSD1306 1.6.2 is already the active version in easy-install.pth
Installed /usr/local/lib/python3.11/dist-packages/Adafruit_SSD1306-1.6.2-py3.11.egg
Processing dependencies for Adafruit-SSD1306==1.6.2
Searching for Adafruit-GPIO>=0.6.5
Downloading https://github.com/adafruit/Adafruit_Python_GPIO/tarball/master#egg=Adafruit-GPIO-0.6.5
Best match: Adafruit-GPIO 0.6.5
Processing master
Writing /tmp/easy_install-y3hqds43/adafruit-Adafruit_Python_GPIO-a12fee3/setup.cfg
Running adafruit-Adafruit_Python_GPIO-a12fee3/setup.py -q bdist_egg --dist-dir /tmp/easy_install-y3hqds43/adafruit-Adafruit_Python_GPIO-a12fee3/egg-dist-tmp-tv459uc7
Adafruit GPIO Library
Works best with Python 2.7
THIS INSTALL SCRIPT MAY REQUIRE ROOT/ADMIN PERMISSIONS
Especially if you installed python for "all users" on Windows
try the following in your systems terminal if ensurepip is not sufficient:
$ python -m ensurepip --upgrade
$ python -m pip install --upgrade pip setuptools
/usr/lib/python3/dist-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 156, in save_modules
yield saved
File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 198, in setup_context
yield
File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 259, in run_setup
_execfile(setup_script, ns)
File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 46, in _execfile
exec(code, globals, locals)
File "/tmp/easy_install-y3hqds43/adafruit-Adafruit_Python_GPIO-a12fee3/setup.py", line 26, in <module>
license = 'MIT',
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 108, in setup
return distutils.core.setup(**attrs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/setuptools/_distutils/core.py", line 185, in setup
return run_commands(dist)
^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/setuptools/_distutils/core.py", line 201, in run_commands
dist.run_commands()
File "/usr/lib/python3/dist-packages/setuptools/_distutils/dist.py", line 969, in run_commands
self.run_command(cmd)
File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 1213, in run_command
super().run_command(command)
File "/usr/lib/python3/dist-packages/setuptools/_distutils/dist.py", line 988, in run_command
cmd_obj.run()
File "/usr/lib/python3/dist-packages/setuptools/command/bdist_egg.py", line 165, in run
cmd = self.call_command('install_lib', warn_dir=0)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/setuptools/command/bdist_egg.py", line 151, in call_command
self.run_command(cmdname)
File "/usr/lib/python3/dist-packages/setuptools/_distutils/cmd.py", line 318, in run_command
self.distribution.run_command(command)
File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 1213, in run_command
super().run_command(command)
File "/usr/lib/python3/dist-packages/setuptools/_distutils/dist.py", line 987, in run_command
cmd_obj.ensure_finalized()
File "/usr/lib/python3/dist-packages/setuptools/_distutils/cmd.py", line 111, in ensure_finalized
self.finalize_options()
File "/usr/lib/python3/dist-packages/setuptools/command/install_lib.py", line 17, in finalize_options
self.set_undefined_options('install',('install_layout','install_layout'))
File "/usr/lib/python3/dist-packages/setuptools/_distutils/cmd.py", line 296, in set_undefined_options
setattr(self, dst_option, getattr(src_cmd_obj, src_option))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/setuptools/_distutils/cmd.py", line 107, in __getattr__
raise AttributeError(attr)
AttributeError: install_layout. Did you mean: 'install_platlib'?
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/gi/Adafruit_Python_SSD1306/setup.py", line 20, in <module>
setup(name = 'Adafruit_SSD1306',
File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 108, in setup
return distutils.core.setup(**attrs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/setuptools/_distutils/core.py", line 185, in setup
return run_commands(dist)
^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/setuptools/_distutils/core.py", line 201, in run_commands
dist.run_commands()
File "/usr/lib/python3/dist-packages/setuptools/_distutils/dist.py", line 969, in run_commands
self.run_command(cmd)
File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 1213, in run_command
super().run_command(command)
File "/usr/lib/python3/dist-packages/setuptools/_distutils/dist.py", line 988, in run_command
cmd_obj.run()
File "/usr/lib/python3/dist-packages/setuptools/command/install.py", line 74, in run
self.do_egg_install()
File "/usr/lib/python3/dist-packages/setuptools/command/install.py", line 131, in do_egg_install
cmd.run(show_deprecation=False)
File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 444, in run
self.easy_install(spec, not self.no_deps)
File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 686, in easy_install
return self.install_item(None, spec, tmpdir, deps, True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 733, in install_item
self.process_distribution(spec, dist, deps)
File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 778, in process_distribution
distros = WorkingSet([]).resolve(
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 815, in resolve
dist = self._resolve_dist(
^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 851, in _resolve_dist
dist = best[req.key] = env.best_match(
^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 1123, in best_match
return self.obtain(req, installer)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 1135, in obtain
return installer(requirement)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 705, in easy_install
return self.install_item(spec, dist.location, tmpdir, deps)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 731, in install_item
dists = self.install_eggs(spec, download, tmpdir)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 924, in install_eggs
return self.build_and_install(setup_script, setup_base)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 1198, in build_and_install
self.run_setup(setup_script, setup_base, args)
File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 1182, in run_setup
run_setup(setup_script, args)
File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 249, in run_setup
with setup_context(setup_dir):
File "/usr/lib/python3.11/contextlib.py", line 155, in __exit__
self.gen.throw(typ, value, traceback)
File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 190, in setup_context
with save_modules():
File "/usr/lib/python3.11/contextlib.py", line 155, in __exit__
self.gen.throw(typ, value, traceback)
File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 169, in save_modules
saved_exc.resume()
File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 143, in resume
raise exc.with_traceback(self._tb)
File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 156, in save_modules
yield saved
File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 198, in setup_context
yield
File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 259, in run_setup
_execfile(setup_script, ns)
File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 46, in _execfile
exec(code, globals, locals)
File "/tmp/easy_install-y3hqds43/adafruit-Adafruit_Python_GPIO-a12fee3/setup.py", line 26, in <module>
license = 'MIT',
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 108, in setup
return distutils.core.setup(**attrs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/setuptools/_distutils/core.py", line 185, in setup
return run_commands(dist)
^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/setuptools/_distutils/core.py", line 201, in run_commands
dist.run_commands()
File "/usr/lib/python3/dist-packages/setuptools/_distutils/dist.py", line 969, in run_commands
self.run_command(cmd)
File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 1213, in run_command
super().run_command(command)
File "/usr/lib/python3/dist-packages/setuptools/_distutils/dist.py", line 988, in run_command
cmd_obj.run()
File "/usr/lib/python3/dist-packages/setuptools/command/bdist_egg.py", line 165, in run
cmd = self.call_command('install_lib', warn_dir=0)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/setuptools/command/bdist_egg.py", line 151, in call_command
self.run_command(cmdname)
File "/usr/lib/python3/dist-packages/setuptools/_distutils/cmd.py", line 318, in run_command
self.distribution.run_command(command)
File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 1213, in run_command
super().run_command(command)
File "/usr/lib/python3/dist-packages/setuptools/_distutils/dist.py", line 987, in run_command
cmd_obj.ensure_finalized()
File "/usr/lib/python3/dist-packages/setuptools/_distutils/cmd.py", line 111, in ensure_finalized
self.finalize_options()
File "/usr/lib/python3/dist-packages/setuptools/command/install_lib.py", line 17, in finalize_options
self.set_undefined_options('install',('install_layout','install_layout'))
File "/usr/lib/python3/dist-packages/setuptools/_distutils/cmd.py", line 296, in set_undefined_options
setattr(self, dst_option, getattr(src_cmd_obj, src_option))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/setuptools/_distutils/cmd.py", line 107, in __getattr__
raise AttributeError(attr)
AttributeError: install_layout
gi@RPI5GI:~/Adafruit_Python_SSD1306 $ cd
gi@RPI5GI:~ $ sudo python -m pip install --upgrade pip setuptools wheel
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already satisfied: pip in /usr/lib/python3/dist-packages (23.0.1)
Collecting pip
Downloading https://www.piwheels.org/simple/pip/pip-24.0-py3-none-any.whl (2.1 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.1/2.1 MB 2.2 MB/s eta 0:00:00
Requirement already satisfied: setuptools in /usr/lib/python3/dist-packages (66.1.1)
Collecting setuptools
Downloading https://www.piwheels.org/simple/setuptools/setuptools-69.1.0-py3-none-any.whl (819 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 819.3/819.3 kB 10.8 MB/s eta 0:00:00
Requirement already satisfied: wheel in /usr/lib/python3/dist-packages (0.38.4)
Collecting wheel
Downloading https://www.piwheels.org/simple/wheel/wheel-0.42.0-py3-none-any.whl (65 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 65.4/65.4 kB 3.3 MB/s eta 0:00:00
Installing collected packages: wheel, setuptools, pip
Attempting uninstall: wheel
Found existing installation: wheel 0.38.4
Not uninstalling wheel at /usr/lib/python3/dist-packages, outside environment /usr
Can't uninstall 'wheel'. No files were found to uninstall.
Attempting uninstall: setuptools
Found existing installation: setuptools 66.1.1
Not uninstalling setuptools at /usr/lib/python3/dist-packages, outside environment /usr
Can't uninstall 'setuptools'. No files were found to uninstall.
Attempting uninstall: pip
Found existing installation: pip 23.0.1
Not uninstalling pip at /usr/lib/python3/dist-packages, outside environment /usr
Can't uninstall 'pip'. No files were found to uninstall.
Successfully installed pip-24.0 setuptools-69.1.0 wheel-0.42.0
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
gi@RPI5GI:~ $ sudo pip install Adafruit-SSD1306
DEPRECATION: Loading egg at /usr/local/lib/python3.11/dist-packages/Adafruit_SSD1306-1.6.2-py3.11.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already satisfied: Adafruit-SSD1306 in /usr/local/lib/python3.11/dist-packages/Adafruit_SSD1306-1.6.2-py3.11.egg (1.6.2)
Collecting Adafruit-GPIO>=0.6.5 (from Adafruit-SSD1306)
Downloading https://www.piwheels.org/simple/adafruit-gpio/Adafruit_GPIO-1.0.3-py3-none-any.whl (38 kB)
Collecting adafruit-pureio (from Adafruit-GPIO>=0.6.5->Adafruit-SSD1306)
Downloading https://www.piwheels.org/simple/adafruit-pureio/Adafruit_PureIO-1.1.11-py3-none-any.whl (10 kB)
Requirement already satisfied: spidev in /usr/lib/python3/dist-packages (from Adafruit-GPIO>=0.6.5->Adafruit-SSD1306) (3.5)
Installing collected packages: adafruit-pureio, Adafruit-GPIO
Successfully installed Adafruit-GPIO-1.0.3 adafruit-pureio-1.1.11
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
gi@RPI5GI:~ $ cd /home/gi/Adafruit_Python_SSD1306
gi@RPI5GI:~/Adafruit_Python_SSD1306 $ python3 setup.py
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help
error: no commands supplied
gi@RPI5GI:~/Adafruit_Python_SSD1306 $ sudo python3 setup.py install
running install
/usr/local/lib/python3.11/dist-packages/setuptools/_distutils/cmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated.
!!
********************************************************************************
Please avoid running ``setup.py`` directly.
Instead, use pypa/build, pypa/installer or other
standards-based tools.
See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.
********************************************************************************
!!
self.initialize_options()
/usr/local/lib/python3.11/dist-packages/setuptools/_distutils/cmd.py:66: EasyInstallDeprecationWarning: easy_install command is deprecated.
!!
********************************************************************************
Please avoid running ``setup.py`` and ``easy_install``.
Instead, use pypa/build, pypa/installer or other
standards-based tools.
See https://github.com/pypa/setuptools/issues/917 for details.
********************************************************************************
!!
self.initialize_options()
running bdist_egg
running egg_info
writing Adafruit_SSD1306.egg-info/PKG-INFO
writing dependency_links to Adafruit_SSD1306.egg-info/dependency_links.txt
writing requirements to Adafruit_SSD1306.egg-info/requires.txt
writing top-level names to Adafruit_SSD1306.egg-info/top_level.txt
reading manifest file 'Adafruit_SSD1306.egg-info/SOURCES.txt'
adding license file 'LICENSE'
writing manifest file 'Adafruit_SSD1306.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-aarch64/egg
running install_lib
running build_py
copying Adafruit_SSD1306/__init__.py -> build/lib/Adafruit_SSD1306
copying Adafruit_SSD1306/SSD1306.py -> build/lib/Adafruit_SSD1306
creating build/bdist.linux-aarch64/egg
creating build/bdist.linux-aarch64/egg/Adafruit_SSD1306
copying build/lib/Adafruit_SSD1306/__init__.py -> build/bdist.linux-aarch64/egg/Adafruit_SSD1306
copying build/lib/Adafruit_SSD1306/SSD1306.py -> build/bdist.linux-aarch64/egg/Adafruit_SSD1306
byte-compiling build/bdist.linux-aarch64/egg/Adafruit_SSD1306/__init__.py to __init__.cpython-311.pyc
byte-compiling build/bdist.linux-aarch64/egg/Adafruit_SSD1306/SSD1306.py to SSD1306.cpython-311.pyc
creating build/bdist.linux-aarch64/egg/EGG-INFO
copying Adafruit_SSD1306.egg-info/PKG-INFO -> build/bdist.linux-aarch64/egg/EGG-INFO
copying Adafruit_SSD1306.egg-info/SOURCES.txt -> build/bdist.linux-aarch64/egg/EGG-INFO
copying Adafruit_SSD1306.egg-info/dependency_links.txt -> build/bdist.linux-aarch64/egg/EGG-INFO
copying Adafruit_SSD1306.egg-info/requires.txt -> build/bdist.linux-aarch64/egg/EGG-INFO
copying Adafruit_SSD1306.egg-info/top_level.txt -> build/bdist.linux-aarch64/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents...
creating 'dist/Adafruit_SSD1306-1.6.2-py3.11.egg' and adding 'build/bdist.linux-aarch64/egg' to it
removing 'build/bdist.linux-aarch64/egg' (and everything under it)
Processing Adafruit_SSD1306-1.6.2-py3.11.egg
Removing /usr/local/lib/python3.11/dist-packages/Adafruit_SSD1306-1.6.2-py3.11.egg
Copying Adafruit_SSD1306-1.6.2-py3.11.egg to /usr/local/lib/python3.11/dist-packages
Adding Adafruit-SSD1306 1.6.2 to easy-install.pth file
Installed /usr/local/lib/python3.11/dist-packages/Adafruit_SSD1306-1.6.2-py3.11.egg
Processing dependencies for Adafruit-SSD1306==1.6.2
Searching for Adafruit-GPIO==1.0.3
Best match: Adafruit-GPIO 1.0.3
Adding Adafruit-GPIO 1.0.3 to easy-install.pth file
Using /usr/local/lib/python3.11/dist-packages
Searching for spidev==3.5
Best match: spidev 3.5
Adding spidev 3.5 to easy-install.pth file
Using /usr/lib/python3/dist-packages
Searching for Adafruit-PureIO==1.1.11
Best match: Adafruit-PureIO 1.1.11
Adding Adafruit-PureIO 1.1.11 to easy-install.pth file
Using /usr/local/lib/python3.11/dist-packages
Finished processing dependencies for Adafruit-SSD1306==1.6.2
gi@RPI5GI:~/Adafruit_Python_SSD1306 $ cd examples
gi@RPI5GI:~/Adafruit_Python_SSD1306/examples $ python3 stats.py
Traceback (most recent call last):
File "/home/gi/Adafruit_Python_SSD1306/examples/stats.py", line 47, in <module>
disp = Adafruit_SSD1306.SSD1306_128_32(rst=RST)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/Adafruit_SSD1306-1.6.2-py3.11.egg/Adafruit_SSD1306/SSD1306.py", line 287, in __init__
File "/usr/local/lib/python3.11/dist-packages/Adafruit_SSD1306-1.6.2-py3.11.egg/Adafruit_SSD1306/SSD1306.py", line 85, in __init__
File "/home/gi/.local/lib/python3.11/site-packages/Adafruit_GPIO/GPIO.py", line 426, in get_platform_gpio
raise RuntimeError('Could not determine platform.')
RuntimeError: Could not determine platform.
gi@RPI5GI:~/Adafruit_Python_SSD1306/examples $ python3 stats.py
Traceback (most recent call last):
File "/home/gi/Adafruit_Python_SSD1306/examples/stats.py", line 53, in <module>
disp = Adafruit_SSD1306.SSD1306_128_64(rst=RST, i2c_address=0x3C)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/Adafruit_SSD1306-1.6.2-py3.11.egg/Adafruit_SSD1306/SSD1306.py", line 242, in __init__
File "/usr/local/lib/python3.11/dist-packages/Adafruit_SSD1306-1.6.2-py3.11.egg/Adafruit_SSD1306/SSD1306.py", line 85, in __init__
File "/home/gi/.local/lib/python3.11/site-packages/Adafruit_GPIO/GPIO.py", line 426, in get_platform_gpio
raise RuntimeError('Could not determine platform.')
RuntimeError: Could not determine platform.
gi@RPI5GI:~/Adafruit_Python_SSD1306/examples $ cd
gi@RPI5GI:~ $ sudo pip3 install adafruit-circuitpython-ssd1306
DEPRECATION: Loading egg at /usr/local/lib/python3.11/dist-packages/Adafruit_SSD1306-1.6.2-py3.11.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting adafruit-circuitpython-ssd1306
Downloading https://www.piwheels.org/simple/adafruit-circuitpython-ssd1306/adafruit_circuitpython_ssd1306-2.12.16-py3-none-any.whl (7.6 kB)
Collecting Adafruit-Blinka (from adafruit-circuitpython-ssd1306)
Downloading https://www.piwheels.org/simple/adafruit-blinka/Adafruit_Blinka-8.32.0-py3-none-any.whl (324 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 324.9/324.9 kB 654.6 kB/s eta 0:00:00
Collecting adafruit-circuitpython-busdevice (from adafruit-circuitpython-ssd1306)
Downloading https://www.piwheels.org/simple/adafruit-circuitpython-busdevice/adafruit_circuitpython_busdevice-5.2.6-py3-none-any.whl (7.5 kB)
Collecting adafruit-circuitpython-framebuf (from adafruit-circuitpython-ssd1306)
Downloading https://www.piwheels.org/simple/adafruit-circuitpython-framebuf/adafruit_circuitpython_framebuf-1.6.5-py3-none-any.whl (9.2 kB)
Collecting Adafruit-PlatformDetect>=3.53.0 (from Adafruit-Blinka->adafruit-circuitpython-ssd1306)
Downloading https://www.piwheels.org/simple/adafruit-platformdetect/Adafruit_PlatformDetect-3.60.0-py3-none-any.whl (23 kB)
Requirement already satisfied: Adafruit-PureIO>=1.1.7 in /usr/local/lib/python3.11/dist-packages (from Adafruit-Blinka->adafruit-circuitpython-ssd1306) (1.1.11)
Requirement already satisfied: pyftdi>=0.40.0 in /usr/lib/python3/dist-packages (from Adafruit-Blinka->adafruit-circuitpython-ssd1306) (0.54.0)
Collecting adafruit-circuitpython-typing (from Adafruit-Blinka->adafruit-circuitpython-ssd1306)
Downloading https://www.piwheels.org/simple/adafruit-circuitpython-typing/adafruit_circuitpython_typing-1.10.2-py3-none-any.whl (11 kB)
Requirement already satisfied: RPi.GPIO in /usr/lib/python3/dist-packages (from Adafruit-Blinka->adafruit-circuitpython-ssd1306) (0.7.1a4)
Collecting rpi-ws281x>=4.0.0 (from Adafruit-Blinka->adafruit-circuitpython-ssd1306)
Downloading rpi_ws281x-5.0.0.tar.gz (64 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 64.5/64.5 kB 547.1 kB/s eta 0:00:00
Preparing metadata (setup.py) ... done
Collecting sysv-ipc>=1.1.0 (from Adafruit-Blinka->adafruit-circuitpython-ssd1306)
Downloading https://www.piwheels.org/simple/sysv-ipc/sysv_ipc-1.1.0-cp311-cp311-linux_armv7l.whl (66 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 66.5/66.5 kB 335.5 kB/s eta 0:00:00
Collecting adafruit-circuitpython-requests (from adafruit-circuitpython-typing->Adafruit-Blinka->adafruit-circuitpython-ssd1306)
Downloading https://www.piwheels.org/simple/adafruit-circuitpython-requests/adafruit_circuitpython_requests-2.0.5-py3-none-any.whl (11 kB)
Requirement already satisfied: typing-extensions~=4.0 in /usr/lib/python3/dist-packages (from adafruit-circuitpython-typing->Adafruit-Blinka->adafruit-circuitpython-ssd1306) (4.4.0)
Building wheels for collected packages: rpi-ws281x
Building wheel for rpi-ws281x (setup.py) ... done
Created wheel for rpi-ws281x: filename=rpi_ws281x-5.0.0-cp311-cp311-linux_armv7l.whl size=120535 sha256=1a8e83f7913c4d5ae02b8b5ed5d93d1f87ea0826d3e8389423276146482f66ef
Stored in directory: /root/.cache/pip/wheels/c8/b3/52/cfca661555719e40842e4f28b31e0e80a3f70677444c9adbd9
Successfully built rpi-ws281x
Installing collected packages: sysv-ipc, Adafruit-PlatformDetect, rpi-ws281x, adafruit-circuitpython-requests, adafruit-circuitpython-busdevice, Adafruit-Blinka, adafruit-circuitpython-typing, adafruit-circuitpython-framebuf, adafruit-circuitpython-ssd1306
Successfully installed Adafruit-Blinka-8.32.0 Adafruit-PlatformDetect-3.60.0 adafruit-circuitpython-busdevice-5.2.6 adafruit-circuitpython-framebuf-1.6.5 adafruit-circuitpython-requests-2.0.5 adafruit-circuitpython-ssd1306-2.12.16 adafruit-circuitpython-typing-1.10.2 rpi-ws281x-5.0.0 sysv-ipc-1.1.0
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
gi@RPI5GI:~ $ sudo nano
gi@RPI5GI:~ $ python3 example.py
gi@RPI5GI:~ $ sudo nano
gi@RPI5GI:~ $ python3 stats2.py
Traceback (most recent call last):
File "/home/gi/stats2.py", line 53, in <module>
disp = Adafruit_SSD1306.SSD1306_128_64(rst=RST, i2c_address=0x3C)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/Adafruit_SSD1306-1.6.2-py3.11.egg/Adafruit_SSD1306/SSD1306.py", line 242, in __init__
File "/usr/local/lib/python3.11/dist-packages/Adafruit_SSD1306-1.6.2-py3.11.egg/Adafruit_SSD1306/SSD1306.py", line 85, in __init__
File "/home/gi/.local/lib/python3.11/site-packages/Adafruit_GPIO/GPIO.py", line 426, in get_platform_gpio
raise RuntimeError('Could not determine platform.')
RuntimeError: Could not determine platform.
gi@RPI5GI:~ $ sudo nano stats2.py
gi@RPI5GI:~ $ python3 stats2.py
Traceback (most recent call last):
File "/home/gi/stats2.py", line 50, in <module>
disp = Adafruit_SSD1306.SSD1306_128_64(rst=RST)
^^^
NameError: name 'RST' is not defined
gi@RPI5GI:~ $ sudo nano stats2.py
gi@RPI5GI:~ $ python3 stats2.py
Traceback (most recent call last):
File "/home/gi/stats2.py", line 50, in <module>
disp = Adafruit_SSD1306.SSD1306_128_64(rst=RST)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/Adafruit_SSD1306-1.6.2-py3.11.egg/Adafruit_SSD1306/SSD1306.py", line 242, in __init__
File "/usr/local/lib/python3.11/dist-packages/Adafruit_SSD1306-1.6.2-py3.11.egg/Adafruit_SSD1306/SSD1306.py", line 85, in __init__
File "/home/gi/.local/lib/python3.11/site-packages/Adafruit_GPIO/GPIO.py", line 426, in get_platform_gpio
raise RuntimeError('Could not determine platform.')
RuntimeError: Could not determine platform.
gi@RPI5GI:~ $ sudo nano
gi@RPI5GI:~ $ python3 Stats3.py
두 번째 부분에서 언급한 stats3.py 코드는 아래에 있다.
i basically found this cmd :
sudo rm /usr/lib/python3.11/EXTERNALLY-MANAGED
after running that i was able to install packages system-wide.
then i tried installing Adafruit_GPIO:
pip install Adafruit-GPIO
then i tried to use this
sudo python -m pip install --upgrade pip setuptools wheel
it would install but i would get this error message:
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
eventually i used this lib:
adafruit-circuitpython-ssd1306
with this cmd:
sudo pip3 install adafruit-circuitpython-ssd1306
then in the cmdline
i created a script using chatgpt (for testing)
its basically stats.py
stats3.py
here it is working
thanks for the help guys i really appreciate it
stats3.py 코드
# Import necessary libraries
from board import SCL, SDA
import busio
from PIL import Image, ImageDraw, ImageFont
import adafruit_ssd1306
import subprocess
import psutil
# Create the I2C interface
i2c = busio.I2C(SCL, SDA)
# Create the SSD1306 OLED class
display = adafruit_ssd1306.SSD1306_I2C(128, 32, i2c)
# Clear display
display.fill(0)
display.show()
# Create blank image for drawing with mode '1' for 1-bit color
width = display.width
height = display.height
image = Image.new('1', (width, height))
# Get drawing object to draw on image
draw = ImageDraw.Draw(image)
# Draw a black filled box to clear the image
draw.rectangle((0, 0, width, height), outline=0, fill=0)
# Define some constants to allow easy resizing of shapes
padding = -2
top = padding
bottom = height - padding
# Move left to right keeping track of the current x position for drawing shapes
x = 0
# Load a default font
font = ImageFont.load_default()
# Collect system information
def get_system_info():
# CPU usage
cpu_usage = f"CPU: {psutil.cpu_percent()}%"
# RAM usage
ram = psutil.virtual_memory()
ram_usage = f"RAM: {ram.percent}%"
# IP address
cmd = "hostname -I | cut -d' ' -f1"
ip_address = subprocess.check_output(cmd, shell=True).decode("utf-8").strip()
ip_info = f"IP: {ip_address}"
return cpu_usage, ram_usage, ip_info
# Display system information on OLED
while True:
# Draw a black filled box to clear the image
draw.rectangle((0, 0, width, height), outline=0, fill=0)
# Get system info
cpu_usage, ram_usage, ip_info = get_system_info()
# Write lines of text
draw.text((x, top + 0), cpu_usage, font=font, fill=255)
draw.text((x, top + 8), ram_usage, font=font, fill=255)
draw.text((x, top + 16), ip_info, font=font, fill=255)
# Display image
display.image(image)
display.show()
실행 화면 이미지
반응형
'라즈베리파이 5' 카테고리의 다른 글
서울시 빅데이터 캠퍼스 공모전 수상작 (4) | 2024.11.06 |
---|---|
라즈베리 파이, 일상적인 AI 카메라 시대 열었다. (5) | 2024.10.01 |
라즈베리파이 하둡/스파크 클러스터 구축하기 (1) | 2024.09.19 |
라즈베리 파이 5 NVMe 프로토콜 M.2 솔리드 스테이트 드라이브용 어댑터 (0) | 2024.09.10 |
시드 스튜디오, 초소형 라즈베리파이 RP2350 기반 XIAO RP2350 발표 (3) | 2024.08.31 |
라즈베리파이 Python 9 - 버튼 채터링 방지 (2) | 2024.08.27 |
라즈베리파이 Python 8 - 버튼 (1) | 2024.08.26 |
라즈베리파이 python 7 - 교통 신호등 (0) | 2024.08.23 |
더욱 좋은 정보를 제공하겠습니다.~ ^^