What I did when updating from Python 2.6 to 2.7

Reposting past articles that I wrote down on Hatena series (maybe a little old)

Install what you need for installation

$ sudo yum install zlib zlib-devel tk-devel tcl-devel sqlite-devel ncurses-devel gdbm-devel readline-devel bzip2-devel db4-devel openssl-devel

Download and unzip Python

$ wget http://python.org/ftp/python/2.7.2/Python-2.7.2.tgz $ tar zxvf Python-2.7.2.tgz

Installation

$ cd Python-2.7.2 $ ./configure --with-threads --enable-shared

Error countermeasures (for x86_64) If you execute it here

python: error while loading shared libraries: libpython2.7.so.1.0: cannot open shared object file: No such file or directory

Does not work with an error. Since it has been compiled, paste the symbolic.

$ ln -s /usr/local/lib/libpython2.7.so.1.0 /lib64/

@CentOS

Python 2.7 install

http://wasure-memo.h-tsk.com/2012/03/centos-62-python-272.html http://memo.yomukaku.net/entries/jbRkQkq

wget http://python.org/ftp/python/2.7.2/Python-2.7.2.tgztar zxvf Python-2.7.2.tgz
sudo yum install zlib zlib-devel tk-devel tcl-devel sqlite-devel ncurses-devel gdbm-devel readline-devel bzip2-devel db4-devel openssl-devel
cd Python-2.7.2
./configure --with-threads --enable-shared
make
sudo make install
python2.7

pip install

wget http://peak.telecommunity.com/dist/ez_setup.py
sudo /usr/local/bin/easy_install-2.7 pip

$ sudo /usr/local/bin/pip-2.7 install jubatus

$ sudo /usr/local/bin/pip-2.7 install MySQL-python

Error 1: I was angry that mysql_config was missing here

$ sudo yum install MySQL-devel.x86_64
$ which mysql_config

Error 2: Cannot install

solution

(Forcibly)

$ sudo cp -rp /usr/lib64/python2.6/site-packages/_mysql* /usr/local/lib/python2.7/site-packages
$ sudo cp -rp /usr/lib64/python2.6/site-packages/MySQL* /usr/local/lib/python2.7/site-packages

I was able to ...

By the way, the error log of error 2 is

$ sudo /usr/local/bin/pip install MySQL-python
Downloading/unpacking MySQL-python
  Running setup.py egg_info for package MySQL-python
   
Installing collected packages: MySQL-python
  Running setup.py install for MySQL-python
    building '_mysql' extension
    gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Dversion_info=(1,2,4,'final',1) -D__version__=1.2.4 -I/usr/include/mysql -I/usr/local/include/python2.7 -c _mysql.c -o build/temp.linux-x86_64-2.7/_mysql.o -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -fPIC -g -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing -DMY_PTHREAD_FASTMUTEX=1
    _mysql.c:In the file included from 44:
    /usr/include/mysql/my_config.h:422:1:warning: "HAVE_WCSCOLL"Has been redefined
    /usr/local/include/python2.7/Python.h:In the file included from 8,
                     _mysql.c:From 29:
    /usr/local/include/python2.7/pyconfig.h:887:1:warning:This is where the previous declaration is
    gcc -pthread -shared build/temp.linux-x86_64-2.7/_mysql.o -L/usr/lib64 -L/usr/local/lib -lmysqlclient_r -lpthread -lm -lrt -ldl -lpython2.7 -o build/lib.linux-x86_64-2.7/_mysql.so
    /usr/bin/ld: cannot find -lmysqlclient_r
    collect2:ld exited with status 1
    error: command 'gcc' failed with exit status 1
    Complete output from command /usr/local/bin/python2.7 -c "import setuptools;__file__='/tmp/pip-build-root/MySQL-python/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-Q9RYLv-record/install-record.txt --single-version-externally-managed:
    running install

running build

running build_py

copying _mysql_exceptions.py -> build/lib.linux-x86_64-2.7

copying MySQLdb/__init__.py -> build/lib.linux-x86_64-2.7/MySQLdb

copying MySQLdb/converters.py -> build/lib.linux-x86_64-2.7/MySQLdb

copying MySQLdb/connections.py -> build/lib.linux-x86_64-2.7/MySQLdb

copying MySQLdb/cursors.py -> build/lib.linux-x86_64-2.7/MySQLdb

copying MySQLdb/release.py -> build/lib.linux-x86_64-2.7/MySQLdb

copying MySQLdb/times.py -> build/lib.linux-x86_64-2.7/MySQLdb

copying MySQLdb/constants/__init__.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants

copying MySQLdb/constants/CR.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants

copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants

copying MySQLdb/constants/ER.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants

copying MySQLdb/constants/FLAG.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants

copying MySQLdb/constants/REFRESH.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants

copying MySQLdb/constants/CLIENT.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants

running build_ext

building '_mysql' extension

gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Dversion_info=(1,2,4,'final',1) -D__version__=1.2.4 -I/usr/include/mysql -I/usr/local/include/python2.7 -c _mysql.c -o build/temp.linux-x86_64-2.7/_mysql.o -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -fPIC -g -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing -DMY_PTHREAD_FASTMUTEX=1

_mysql.c:In the file included from 44:

/usr/include/mysql/my_config.h:422:1:warning: "HAVE_WCSCOLL"Has been redefined

/usr/local/include/python2.7/Python.h:In the file included from 8,

                 _mysql.c:From 29:

/usr/local/include/python2.7/pyconfig.h:887:1:warning:This is where the previous declaration is

gcc -pthread -shared build/temp.linux-x86_64-2.7/_mysql.o -L/usr/lib64 -L/usr/local/lib -lmysqlclient_r -lpthread -lm -lrt -ldl -lpython2.7 -o build/lib.linux-x86_64-2.7/_mysql.so

/usr/bin/ld: cannot find -lmysqlclient_r

collect2:ld exited with status 1

error: command 'gcc' failed with exit status 1

----------------------------------------
Command /usr/local/bin/python2.7 -c "import setuptools;__file__='/tmp/pip-build-root/MySQL-python/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-Q9RYLv-record/install-record.txt --single-version-externally-managed failed with error code 1 in /tmp/pip-build-root/MySQL-python

Recommended Posts

What I did when updating from Python 2.6 to 2.7
What I did to save Python memory
[Python] What I did to do Unit Test
What I was addicted to when using Python tornado
Did not change from Python 2 to 3
What I did to welcome the Python2 EOL with confidence
What I was addicted to when migrating Processing users to Python
What I referred to when studying tkinter
I want to use jar from python
What I got from Python Boot Camp
What I did with a Python array
What I was addicted to Python autorun
What I was addicted to when introducing ALE to Vim for Python
Changes from Python 3.0 to Python 3.5
Changes from Python 2 to Python 3.0
I want to email from Gmail using Python.
A story I was addicted to when inserting from Python to a PostgreSQL table
[Python] I want to manage 7DaysToDie from Discord! 1/3
[Python] Warning came out when I raised from Selenium 3 to 4 [Web Driver]
I tried Python! ] I graduated today from "What is Python! Python!"!
[Python] I want to manage 7DaysToDie from Discord! 2/3
[Question] What happens when I use% in python?
I want to make C ++ code from Python code!
[At Coder] What I did to reach the green rank in Python
What failed when going from Javaer to Pythonista
What I did when I got stuck in the time limit with lambda python
What I do when imitating embedded go in python
When I tried to introduce python3 to atom, I got stuck
Python --Notes when converting from str type to int type
[Python3] I want to generate harassment names from Japanese!
What to do when "cannot import name xxx" [Python]
What I did to ssh to the VPS Ubuntu environment
What I did to get started with Linux commands
I want to do something in Python when I finish
What to do when you can't bind CaboCha to Python
Post from Python to Slack
Cheating from PHP to Python
Switch from python2.7 to python3.6 (centos7)
Connect to sqlite from python
What I learned in Python
What I did when I was angry to put it in with the enable-shared option
[Python] I started Poetry & Impression that I moved from Pipenv to poetry
What I did to speed up the string search task
I tried to create API list.csv in Python from swagger.yaml
What to do when a Remove Error occurs when updating conda
I want to start a lot of processes from python
What to do when "SSL: CERTIFICATE_VERIFY_FAILED _ssl.c: 1056" appears in Python
I want to send a message from Python to LINE Bot
I tried changing the python script from 2.7.11 to 3.6.0 on windows10
[Python3] List of sites that I referred to when I started Python
What to do when Ubuntu crashes
Points to note when updating to WSL2
I tried to touch Python (installation)
Create folders from '01' to '12' with python
[Lambda] [Python] Post to Twitter from Lambda!
H29.2.27 ~ 3.5 Summary of what I did
Connect to utf8mb4 database from python
Python (from first time to execution)
What to do with PYTHON release?
Post images from Python to Tumblr
How to access wikipedia from python