CentOS大数据实验环境更改记录
admin
2023-07-31 01:44:05
0

CentOS大数据实验环境更改记录

标签(空格分隔): 未分类


1.修改163的yum源

使用说明

首先备份/etc/yum.repos.d/CentOS-Base.repo

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

下载对应版本repo文件, 放入/etc/yum.repos.d/(操作前请做好相应备份)

CentOS6

运行以下命令生成缓存

yum clean all
yum makecache

2.更新python从2.6.6版本为2.7

#wget http://www.python.org/ftp/python/2.7.5/Python-2.7.5.tar.bz2
#tar jxvf Python-2.7.5.tar.bz2
#cd Python-2.7.5
#./configure --prefix=/usr/local 
#make && make altinstall 
#mv /usr/bin/python /usr/bin/python2.6.6
#ln -s /usr/local/bin/python2.7 /usr/bin/python

3.安装pip
1)安装setuptools
解压安装遇到错误
RuntimeError: Compression requires the (missing) zlib module

yum install zlib& zilib devel

然后遇到yum因为python版本不对错误错误:

[root@localhost bin]# yum install pip
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:

   No module named yum

Please install a package which provides this module, or
verify that the module is installed correctly.

It\'s possible that the above module doesn\'t match the
current version of Python, which is:
2.7.3 (default, Jan 16 2016, 05:59:11) 
[GCC 4.4.6 20120305 (Red Hat 4.4.6-4)]

If you cannot solve this problem yourself, please go to 
the yum faq at:
  http://yum.baseurl.org/wiki/Faq

查找yum文件,并编辑此py文件

[root@develop local]# which yum
/usr/bin/yum
[root@develop local]# vi /usr/bin/yum

将
#!/usr/bin/python
改为:
#!/usr/bin/python2.6

然后保存OK.

补充:yum基于python写的。

4.安装zlib&zlib-devel
重新编译python
/.configure
make
make install
然后重新安装setuptools

5.遇到wangqi is not in the sudoers file.

#visudo
## Allow root to run any commands anywhere
root    ALL=(ALL)       ALL
wangqi  ALL=(ALL)       ALL

6.遇到ImportError: cannot import name HTTPSHandler
yum install openssl openssl-devel -y
之后,再重新安装Python即可。
/.configure
make
make install

7.pip安装完成
8.安装numpy,
9.安装pandas
出现问题:
UnicodeDecodeError: \’ascii\’ codec can\’t decode byte 0xe2 in position 32: ordinal not in range(128)
解决方法:
修改mimetypes.py文件,路径位于python的安装路径下的Lib\\mimetypes.py文件。在import下添加如下几行:

if sys.getdefaultencoding() != \'gbk\': 
    reload(sys) 
    sys.setdefaultencoding(\'gbk\')

依然报错:

gcc: error trying to exec \'cc1plus\': execvp: No such file or directory

error: command \'gcc\' failed with exit status 1

尝试解决:
yum -y install gcc

依然报错:

Command /usr/local/bin/python -c \"import setuptools, tokenize;__file__=\'/tmp/pip_build_root/pandas/setup.py\';exec(compile(getattr(tokenize, \'open\', open)(__file__).read().replace(\'\\r\\n\', \'\\n\'), __file__, \'exec\'))\" install --record /tmp/pip-5RbGXm-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_root/pandas
Traceback (most recent call last):
  File \"/usr/local/bin/pip\", line 9, in 
    load_entry_point(\'pip==1.5.6\', \'console_scripts\', \'pip\')()
  File \"/usr/local/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/__init__.py\", line 185, in main
    return command.main(cmd_args)
  File \"/usr/local/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/basecommand.py\", line 161, in main
    text = \'\\n\'.join(complete_log)
UnicodeDecodeError: \'gbk\' codec can\'t decode bytes in position 97-98: illegal multibyte sequence

使用安装包直接进行安装,发现是以下问题:

gcc: error trying to exec \'cc1plus\': execvp: No such file or directory
error: command \'gcc\' failed with exit status 1

安装gcc-c++

[root@localhost pandas-0.17.1]# yum list gcc-c++
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
Available Packages
gcc-c++.i686                                 4.4.7-16.el6                                  base
[root@localhost pandas-0.17.1]# yum -y install gcc-c++.i686 

遇到问题

No local packages or download links found for python-dateutil
error: Could not find suitable distribution for Requirement.parse(\'python-dateutil\')

pip install python-dateutil

终于大功告成

上一篇:python tips(2)

下一篇:python3.x安装cv2失败

相关内容

热门资讯

Mobi、epub格式电子书如... 在wps里全局设置里有一个文件关联,打开,勾选电子书文件选项就可以了。
定时清理删除C:\Progra... C:\Program Files (x86)下面很多scoped_dir开头的文件夹 写个批处理 定...
scoped_dir32_70... 一台虚拟机C盘总是莫名奇妙的空间用完,导致很多软件没法再运行。经过仔细检查发现是C:\Program...
500 行 Python 代码... 语法分析器描述了一个句子的语法结构,用来帮助其他的应用进行推理。自然语言引入了很多意外的歧义,以我们...
小程序支付时提示:appid和... [Q]小程序支付时提示:appid和mch_id不匹配 [A]小程序和微信支付没有进行关联,访问“小...
pycparser 是一个用... `pycparser` 是一个用 Python 编写的 C 语言解析器。它可以用来解析 C 代码并构...
微信小程序使用slider实现... 众所周知哈,微信小程序里面的音频播放是没有进度条的,但最近有个项目呢,客户要求音频要有进度条控制,所...
65536是2的几次方 计算2... 65536是2的16次方:65536=2⁶ 65536是256的2次方:65536=256 6553...
Apache Doris 2.... 亲爱的社区小伙伴们,我们很高兴地向大家宣布,Apache Doris 2.0.0 版本已于...
项目管理和工程管理的区别 项目管理 项目管理,顾名思义就是专注于开发和完成项目的管理,以实现目标并满足成功标准和项目要求。 工...