0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

pip inastallしたモジュールが読み込めない

Last updated at Posted at 2023-04-06

keybordモジュールは既にインストールされる場合
下記のように表示される
ターミナル上で実行

PS C:\Users\1> pip install keyboard
Requirement already satisfied: keyboard in c:\users\1\appdata\local\programs\python\python310\lib\site-packages

モジュール読み込み先を確認
python上で実行

 import sys, pprint
pprint.pprint(sys.path)
['',
 'C:\\Python311\\python311.zip',
 'C:\\Users\\1\\AppData\\Local\\Programs\\Python\\Python311\\Lib',
 'C:\\Users\\1\\AppData\\Local\\Programs\\Python\\Python311\\DLLs',
 'C:\\Python311\\DLLs',
 'C:\\Python311\\Lib',
 'C:\\Python311']

c:\users\1\appdata\local\programs\python\python310\lib\site-packagesを読み込み先に追加する
python上で実行

import sys

# 追加するディレクトリを指定
new_path = r'C:\Users\1\AppData\Local\Programs\Python\Python310\lib\site-packages'
# sys.pathに新しいパスを追加
sys.path.append(new_path)

追加成功したか確認
python上で実行

>>> import sys, pprint
>>> pprint.pprint(sys.path)
['',
 'C:\\Python311\\python311.zip',
 'C:\\Users\\1\\AppData\\Local\\Programs\\Python\\Python311\\Lib',
 'C:\\Users\\1\\AppData\\Local\\Programs\\Python\\Python311\\DLLs',
 'C:\\Python311\\DLLs',
 'C:\\Python311\\Lib',
 'C:\\Python311',
 'C:\\Users\\1\\AppData\\Local\\Programs\\Python\\Python310\\lib\site-packages']

追加されました

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?