Trying to use vaex, is it a bug in the OS default Python 2.7.5? Cannot be used by I was lightly addicted to installing Python 2.7.17 and trying to continue the project, so make a note.
CentOS 7.5.1804 Python2.7.17 Poetry 1.0.5 tcsh
I tried other installation methods such as pyenv, but decided to use sclo python, which seems to be the easiest to build an environment on another machine.
sudo yum -y install centos-release-scl-rh
sudo yum -y install python27
Normally, / opt / rh / python27 / enable
should be installed here, but there are times when it is not done for some reason.
In that case, either handwrite it or install python36 etc. and copy and modify enable.
Since enable is written in bash, rewrite it in tcsh.
vim /opt/rh/python27/enable
#!/usr/bin/env tcsh
if ($?PATH) then
setenv PATH /opt/rh/python27/root/usr/bin:${PATH}
else
setenv PATH /opt/rh/python27/root/usr/bin
endif
if ($?LD_LIBRARY_PATH) then
setenv LD_LIBRARY_PATH /opt/rh/python27/root/usr/lib64:${LD_LIBRARY_PATH}
else
setenv LD_LIBRARY_PATH /opt/rh/python27/root/usr/lib64
endif
if ($?MANPATH) then
setenv MANPATH /opt/rh/python27/root/usr/share/man:${MANPATH}
else
setenv MANPATH /opt/rh/python27/root/usr/share/man
endif
if ($?PKG_CONFIG_PATH) then
setenv PKG_CONFIG_PATH /opt/rh/python27/root/usr/lib64/pkgconfig:${PKG_CONFIG_PATH}
else
setenv PKG_CONFIG_PATH /opt/rh/python27/root/usr/lib64/pkgconfig
endif
if ($?XDG_DATA_DIRS) then
setenv XDG_DATA_DIRS /opt/rh/python27/root/usr/share:${XDG_DATA_DIRS}
else
setenv XDG_DATA_DIRS /opt/rh/python27/root/usr/share
endif
Since it is tcsh, scl enable python27 tcsh
cannot be used like other shells, so enable is directly sourced and enabled.
$ python -V
Python 2.7.5
$ source /opt/rh/python27/enable
$ python -V
Python 2.7.17
OK if the version has changed properly.
p
** in the shell that sourced enable ** poetry init
If you have already created virtualenv with OS Python, delete the environment once and poetry install
This will create an environment in SCLO Python.
There is no problem with the statement used from the terminal so far, but when I tried to use Python in the created environment from PyCharm, an error occurred and it did not work. (Error log disappeared)
The cause was that the environment variable set by enable was not set from PyCharm. It's not very pretty, but I solved it by making python2.7 a shell script and source enable when executing python.
cd `poetry env info --path`/bin
mv python2.7 python2.7_original
vim python2.7
python2.7
#!/usr/bin/env tcsh
source /opt/rh/python27/enable
`dirname $0`/python2.7_original $*
Recommended Posts