美文网首页java技术研发
python -ImportError: No module n

python -ImportError: No module n

作者: 麦芽maiya | 来源:发表于2020-08-30 10:30 被阅读0次

确保正确设置了PYTHONHOME环境变量。

如果PYTHONHOME指向无效的位置或您要运行的其他Python安装,您将收到此错误。

试试这个:

C:\>set PYTHONHOME=C:\Python27C:\>python

setx PYTHONHOME C:\Python27

将其永久设置为后续命令提示符

快速解决方案:设置PYTHONHOME和PYTHONPATH并在PATH上包含PYTHONHOME

例如,如果您安装到c:\ Python27

set PYTHONHOME=c:\Python27

set PYTHONPATH=c:\Python27\Lib

set PATH=%PYTHONHOME%;%PATH%

Windows:

setPATH="path\to\Clarisse";%PATH%

setPYTHONPATH="path\to\Clarisse\python";%PYTHONPATH%

Linux:

export PATH="path/to/Clarisse/":$PATH

export PYTHONPATH="path/to/Clarisse/python":$PYTHONPATH

export LD_LIBRARY_PATH="path/to/Clarisse":"path/to/Clarisse/python":$LD_LIBRARY_PATH

macOS:

export PATH="path/to/Clarisse/":$PATH

export PYTHONPATH="path/to/Clarisse/python":$PYTHONPATH

export DYLD_LIBRARY_PATH="path/to/Clarisse":"path/to/Clarisse/python":$DYLD_LIBRARY_PATH

相关文章

网友评论

    本文标题:python -ImportError: No module n

    本文链接:https://www.haomeiwen.com/subject/nncssktx.html