gpt4 book ai didi

python - 无法在 Pycharm 中导入包

转载 作者:行者123 更新时间:2023-12-01 01:06:32 25 4
gpt4 key购买 nike

问题:无法在Pycharm3.5中导入模块

例如:挑选paramiko

软件包已安装

C:\Users\rj>pip3 install paramiko
Requirement already satisfied: paramiko in c:\users\rj\appdata\local\programs\python\python37-32\lib\site-packages (2.4.2)
Requirement already satisfied: pyasn1>=0.1.7 in c:\users\rj\appdata\local\programs\python\python37-32\lib\site-packages (from paramiko) (0.4.5)
Requirement already satisfied: bcrypt>=3.1.3 in c:\users\rj\appdata\local\programs\python\python37-32\lib\site-packages (from paramiko) (3.1.6)
Requirement already satisfied: pynacl>=1.0.1 in c:\users\rj\appdata\local\programs\python\python37-32\lib\site-packages (from paramiko) (1.3.0)
Requirement already satisfied: cryptography>=1.5 in c:\users\rj\appdata\local\programs\python\python37-32\lib\site-packages (from paramiko) (2.6.1)
Requirement already satisfied: cffi>=1.1 in c:\users\rj\appdata\local\programs\python\python37-32\lib\site-packages (from bcrypt>=3.1.3->paramiko) (1.12.2)
Requirement already satisfied: six>=1.4.1 in c:\users\rj\appdata\local\programs\python\python37-32\lib\site-packages (from bcrypt>=3.1.3->paramiko) (1.12.0)
Requirement already satisfied: asn1crypto>=0.21.0 in c:\users\rj\appdata\local\programs\python\python37-32\lib\site-packages (from cryptography>=1.5->paramiko) (0.24.0)
Requirement already satisfied: pycparser in c:\users\rj\appdata\local\programs\python\python37-32\lib\site-packages (from cffi>=1.1->bcrypt>=3.1.3->paramiko) (2.19)

Python 脚本:

from paramiko import *

ssh = SSHClient()
ssh.load_system_host_keys()
ssh.set_missing_host_key_policy(AutoAddPolicy())
ssh.connect("10.10.220.28", username="root", password="mavenir", port=22)
stdin, stdout, stderr = ssh.exec_command("ls")
ssh_output = stdout.read()
print(ssh_output)

观察到以下错误

C:\Users\rj\PycharmProjects\untitled1\venv\Scripts\python.exe C:/Users/rj/PycharmProjects/untitled1/ssh.py
Traceback (most recent call last):
File "C:/Users/rj/PycharmProjects/untitled1/ssh.py", line 1, in <module>
from paramiko import *
ModuleNotFoundError: No module named 'paramiko'

Process finished with exit code 1

还添加了环境变量。

在大多数包中观察到这个问题

最佳答案

在 Pycharm 中,转到文件-->设置--项目-->项目解释器。然后点击加号,然后输入 paramiko

从 Pycharm 中安装软件包有助于确保您始终将其安装在 venv 中。

如果这不是解决方案,它应该会插入您的调查并回答 @Cani 的问题。

关于python - 无法在 Pycharm 中导入包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55297850/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com