简体   繁体   English

ModuleNotFoundError:在pip安装pyserial之后,没有名为“ serial”的模块

[英]ModuleNotFoundError: No module named 'serial' after pip install pyserial

When trying to run a .py file from a command prompt I am getting the error, 当尝试从命令提示符运行.py文件时,出现错误,

File "C:\\Users\\mayna\\Anaconda3\\lib\\site-packages\\lucidIo\\Com.py", line 7, in import serial ModuleNotFoundError: No module named 'serial' 导入串行ModuleNotFoundError中的文件“ C:\\ Users \\ mayna \\ Anaconda3 \\ lib \\ site-packages \\ lucidIo \\ Com.py”,第7行:没有名为“ serial”的模块

This is even after I have installed the pyserial module using 即使在我使用以下方法安装了pyserial模块之后

pip install pyserial

The following line, pip list modules shows that pyserial 3.4 is in fact installed yet for some reason when I try to import serial in a command prompt it gives me the module not found error. 下面的行, pip list modules显示pyserial 3.4实际上已经安装,但是由于某种原因,当我尝试在命令提示符下导入serial时,它给了我模块未找到的错误。 The thing that is really throwing me off is that when I directly open a python window and try accessing serial I get this, 真正让我失望的是,当我直接打开python窗口并尝试访问serial时,我得到了这一点,

>>> import serial     
>>> serial  
<module 'serial' from 'C:\\Users\\mayna\\AppData\\Local\\Programs\\Python\\Python37-32\\lib\\site-packages\\serial\\__init__.py'>   

I am not sure where to go from here, I am new to python but from what I have already researched I should not be getting this error anymore. 我不确定从这里去哪里,我是python的新手,但是根据我已经研究的内容,我不应该再遇到此错误。 I am running python 3.7 on a windows 10 pc. 我在Windows 10 PC上运行python 3.7。

Any help would be greatly appreciated. 任何帮助将不胜感激。 Thank you. 谢谢。

(Removing comments and adding it as an answer) (删除评论并将其添加为答案)

Since you have anaconda installed, try this: 由于您已安装anaconda,请尝试以下操作:

conda install pyserial
or
conda install -c conda-forge pyserial

The main reason for this issue would be, that your pip is installing this module in a separate location or to the python's other version in your machine. 造成此问题的主要原因是,您的pip将此模块安装在单独的位置,或者安装到计算机中python的其他版本。 And you are running Python, maybe on Jupyter or some other IDE which runs via Anaconda. 您正在运行Python,也许是在Jupyter或通过Anaconda运行的其他IDE上。 So using above conda install, will install all the dependencies in the required continuum folder from where conda IDEs intake the modules. 因此,使用上述conda install,将所有依赖项安装在conda IDE从中获取模块的所需continuum文件夹中。 No, you don't need to uninstall anything mayna, just run the above command in cmd and it should work. 不,您不需要卸载任何mayna,只需在cmd中运行以上命令即可。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 ModuleNotFoundError: 没有命名模块<modulename> pip安装后 - ModuleNotFoundError: No module named <modulename> after pip install ModuleNotFoundError:pip安装后没有名为“请求”的模块 - ModuleNotFoundError: No module named 'requests' after pip install ModuleNotFoundError:使用“pip install numpy”后没有名为“numpy”的模块 - ModuleNotFoundError: No module named 'numpy' after using 'pip install numpy' pip安装后出现“ ModuleNotFoundError:没有名为“ PyQt5”的模块” - “ModuleNotFoundError: No module named 'PyQt5'” after pip install ModuleNotFoundError: 执行 pip install xyz 后没有名为“xyz”的模块 - ModuleNotFoundError: No module named 'xyz' " after doing pip install xyz “ImportError: No module named serial” - 安装 pyserial 后 - “ImportError: No module named serial” - after installing pyserial pip安装错误:ModuleNotFoundError没有名为“ setuptools”的模块 - pip install error: ModuleNotFoundError No module named 'setuptools' windows 10 python 串口模块未找到,但 pip 安装 pyserial 已通过 - windows 10 python serial module not found, but pip install pyserial passed ModuleNotFoundError: 没有名为“串行”的模块 - ModuleNotFoundError: No module named 'serial' 使用 pip install pyserial 后导入序列号不起作用 - Import serial doesnt work after using pip install pyserial
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM