[英]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.