简体   繁体   English

在Google Cloud Shell中安装了python模块,但是python导入给出了ImportError

[英]Installed python module in google cloud shell but python import is giving ImportError

I have tried installing scipy in Google Cloud Shell. 我尝试在Google Cloud Shell中安装scipy。 The package is installed, but a python import is giving "ImportError: No module named scipy". 该软件包已安装,但是python导入给出了“ ImportError:没有名为scipy的模块”。 Screenshot 截图

I have problem only with scipy. 我只对scipy有问题。 Tensorflow and numpy are all working fine. Tensorflow和numpy都工作正常。

This problem should be similar to Installed packages disappeared in Google Cloud Shell . 此问题应类似于Google Cloud Shell中消失的已安装软件包

The problem here is that scipy has not been installed. 这里的问题是尚未安装scipy The process got killed at 99%. 该过程被杀死了99%。 This is caused by how pip tries to install the package. 这是由pip尝试安装软件包的方式引起的。 I suspect that you're using a small VM instance which has memory limitations when pip tries to load the whole file to memory before installing it. 我怀疑您使用的小型VM实例在pip尝试在安装之前将整个文件加载到内存时具有内存限制。

The solution is to install scipy with this command: 解决方案是使用以下命令安装scipy:

pip --no-cache-dir install scipy

Here you ask pip not to cache the file which should do the trick to install scipy on your Google Cloud VM. 在这里,您要求pip不要缓存文件,这应该可以解决在您的Google Cloud VM上安装scipy的问题。 After the successful installation you should be able to import the scipy module as intended. 成功安装后,您应该能够按预期的方式导入scipy模块。

暂无
暂无

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

相关问题 ImportError:即使安装了适用于python的google-cloud,也没有名为Cloud的模块 - ImportError: No module named cloud even though google-cloud for python is installed 以管理员身份在谷歌云 shell 上安装 python 模块 - Install python module on google cloud shell as admin 来自google.cloud导入语言ImportError:没有名为cloud的模块 - from google.cloud import language ImportError: No module named cloud ImportError:AppEngine 中没有名为 cloud 的模块,python - ImportError: No module named cloud in AppEngine, python 无法在 python 脚本中导入 google.cloud 模块 - Can not import google.cloud module in python script 使用google cloud dataflow python的ImportError phonenumbers - ImportError phonenumbers with google cloud dataflow python 导入错误:无法从 Python fastapi 中的“google.cloud”(未知位置)导入名称“tasks_v2” - ImportError: cannot import name 'tasks_v2' from 'google.cloud' (unknown location) in Python fastapi Google API Python 客户端:“从六个.moves 导入 zip 导入错误:没有名为移动的模块” - Google API Python Client: "from six.moves import zip ImportError: No module named moves" 导入错误:虽然我安装了谷歌云视觉,但无法从“google.cloud.vision”导入名称“types” - ImportError: cannot import name 'types' from 'google.cloud.vision' though I have google cloud vision installed 永久升级Google Cloud Shell中的Python运行时? - Permanently upgrade the Python runtime in Google Cloud Shell?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM