无法在Pycharm中导入软件包

贾亚什雷拉杰丹德兰

问题:无法在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中,转到File-->Settings--Project-->Project Interpreter然后按加号,然后键入paramiko

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

如果这不是解决方案,则应继续进行调查并回答@Cani的问题。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

TOP 榜单

热门标签

归档