在 Cloud9 中安装 Python 模块 pandas
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/31598883/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Installing Python module pandas in Cloud9
提问by twalbaum
I'm having a hard time installing certain Python modules in Cloud9 ide.
我很难在 Cloud9 ide 中安装某些 Python 模块。
I have tried using easy_install (their recommended method) and pip but with both I get a ton of warnings and end with errors (find the error messages below).
我曾尝试使用 easy_install(他们推荐的方法)和 pip,但是我收到了大量警告并以错误结束(找到下面的错误消息)。
I have read that memory issues might be the problem, and that a possible solution is to increase the swap space, however apparently Cloud9 does not allow it, since sudo swapon /swap1fails showing Operation not permitted
我已经读到内存问题可能是问题所在,一个可能的解决方案是增加交换空间,但显然 Cloud9 不允许这样做,因为sudo swapon /swap1无法显示Operation not permitted
Anyone ever installed pandas in Cloud9? Any other method I should try?
有人在 Cloud9 中安装过 Pandas 吗?我应该尝试其他任何方法吗?
UPDATE: I managed to install pandas using the Linux distribution's package manager: sudo apt-get install python-pandashowever I get the version 0.13 and I need the current version 0.16 to use pandasql.
更新:我设法使用 Linux 发行版的包管理器安装了 pandas:sudo apt-get install python-pandas但是我得到了 0.13 版,我需要当前的 0.16 版才能使用 pandasql。
This is what I get doing sudo easy_install pandas:
这就是我要做的sudo easy_install pandas:
x86_64-linux-gnu-gcc: internal compiler error: Killed (program cc1)
Please submit a full bug report, with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.8/README.Bugs> for instructions.
error: Setup script exited with error: command 'x86_64-linux-gnu-gcc' failed with exit status 4
This is what I get doing pip install pandas:
这就是我要做的pip install pandas:
Traceback (most recent call last):
File "/usr/bin/pip", line 9, in <module>
load_entry_point('pip==1.5.4', 'console_scripts', 'pip')()
File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 185, in main
return command.main(cmd_args)
File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 161, in main
text = '\n'.join(complete_log)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 41: ordinal not in range(128)
回答by Hans Zimermann
I created 2 scripts to do the job:
我创建了 2 个脚本来完成这项工作:
script 01:
脚本 01:
#! /bin/bash
#Downloading Miniconda 64Bits for Linux
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
#Changing file permission for execution
chmod a+x Miniconda3-latest-Linux-x86_64.sh
#Installing Miniconda
./Miniconda3-latest-Linux-x86_64.sh
# Follow instructions to complete install
# Close and reopen terminal.
echo 'Please close the terminal reopen and run install02.sh script now'
Script 02:
脚本 02:
#! /bin/bash
# Creating environment (sandbox instance called py3 [choose the name you want])
conda create -n py3 python=3 ipython
# Activating created environment
source activate py3
# Install package manager pip
conda install pip
# The installation installs the packages
#pip install numpy
#pip install pandas
#pip install matplotlib
# which ipython is to be used in the environment? pip freeze shows it
pip freeze
# Installing ipython notebook
conda install ipython-notebook
# Installing the packages
conda install numpy
conda install pandas
conda install matplotlib
I have installed more than only pandas, so as you can see in the script you can install any package using conda install package_name
我安装的不仅仅是Pandas,所以你可以在脚本中看到你可以使用安装任何包 conda install package_name
回答by pa1983
Things may have changed since the question was asked, but I found I could use Python 3 pip using the following:
自从提出问题以来,事情可能已经发生了变化,但我发现我可以使用以下命令使用 Python 3 pip:
$ sudo pip-3.6 install pandas
Note that the notation seems to be pip-3.6rather than the typical pip3
请注意,符号似乎pip-3.6不是典型的pip3
回答by Jorge
I have the same problem trying to install pandas version 0.20.3. I think the problem is that by default virtualenv will be installing Python 2 and this version of pandas may not work on it.
我在尝试安装 Pandas 0.20.3 版时遇到了同样的问题。我认为问题是默认情况下 virtualenv 将安装 Python 2,而这个版本的 Pandas 可能无法在它上面工作。
My solution was to create the environment with Python 3 inside cloud 9:
我的解决方案是在 cloud 9 中使用 Python 3 创建环境:
virtualenv -p python3 test
Then activate the environment:
然后激活环境:
source test/bin/activate
Update setuptools and pip:
更新 setuptools 和 pip:
pip install -U setuptools
pip install -U pip
And install pandas with pip:
并使用 pip 安装Pandas:
pip install pandas
That did it.
做到了。
回答by jp0d
I preferred downloading the main package with the following command.
我更喜欢使用以下命令下载主包。
wget https://repo.continuum.io/archive/Anaconda3-4.2.0-Linux-x86_64.sh
wget https://repo.continuum.io/archive/Anaconda3-4.2.0-Linux-x86_64.sh
Then installing it as described in Continuum by using the following.
然后使用以下内容按照 Continuum 中的说明安装它。
bash Anaconda3-4.2.0-Linux-x86_64.sh
bash Anaconda3-4.2.0-Linux-x86_64.sh
It gets everything installed including conda, pip, numpy, scipy and matplotlib etc.
它安装了所有东西,包括 conda、pip、numpy、scipy 和 matplotlib 等。
回答by Tomás Mehdi
I'm not sure which version of Cloud9 I'm using. But on the terminal inside de function directory using this:
venv/bin/pip install pandas -t .has always worked
我不确定我使用的是哪个版本的 Cloud9。但是在 de function 目录内的终端上使用这个:
venv/bin/pip install pandas -t .一直有效

