I want to use the API on a web server
↓ The VM instance of GCP is left unattended, so let's put Nginx in it
↓ Insert pip → jam
(Surely I got an error saying that the python version is low here) ↓ Trying to update python with pyenv → jammed
--Apt is being used by another process! Error
--There is no pyenv! I was told After installing it, there is a pyenv configuration file! I was told. --The pass didn't pass.
"If you use Python, you can make a web application" https://qiita.com/cabernet_rock/items/852fc7c5d382fdc422a3
"How to update the python version of Cloud Shell on GCP" https://qiita.com/greenteabiscuit/items/cbecdf4f84f0b73ff96e
"The story of installing pyenv on ubuntu 20.04 [Updated on 2020/07/18]" https://qiita.com/neruoneru/items/1107bcdca7fa43de673d
Ubuntu 16.04.7 LTS (GNU/Linux 4.15.0-1080-gcp x86_64)
$ pip
The program 'pip' is currently not installed. To run 'pip' please ask your administrator to install the package 'python-pip'
$ sudo apt-get update
$ sudo apt install python-pip
E: Could not get lock /var/lib/dpkg/lock-frontend - open (11: Resource temporarily unavailable)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?
An error has occurred. It seems to be a common error. Isn't it used by another process? And that.
$ rm -rf ~/.pyenv
It didn't work. Or rather, it should have been erased here, but did it come out later?
$ ps aux | grep apt | grep -v 'grep'
root 2035 0.0 0.1 4504 708 ? Ss 11:37 0:00 /bin/sh /usr/lib/apt/apt.systemd.daily install
root 2050 0.0 0.2 4504 1684 ? S 11:37 0:00 /bin/sh /usr/lib/apt/apt.systemd.daily lock_is_hel
d install
root 2610 0.7 3.1 39640 18884 pts/1 Ss+ 11:39 0:00 /usr/bin/dpkg --status-fd 12 --unpack --auto-decon
figure /var/cache/apt/archives/libx11-data_2%3a1.6.3-1ubuntu2.2_all.deb
I found out when I looked it up, but I don't know which one is the kill PID.
$ sudo apt autoremove
I was able to go with this. I'm not sure, but I think he did a good job and erased the unnecessary things.
$ sudo apt-get install -y git
$ git clone https://github.com/pyenv/pyenv.git ~/.pyenv
fatal: destination path '/home/[User name]/.pyenv' already exists and is not an empty directory.
It seems that the installation is done, so maybe the path doesn't pass? I guess.
At the referenced site, you should be in the path with the following command.
# add to path
echo 'export PATH="$HOME/.pyenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(pyenv init -)"' >> ~/.bashrc
echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.bashrc
If you refer to other sites,
# .bashrc update
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(pyenv init -)"' >> ~/.bashrc
source ~/.bashrc
It has become. Chant the missing part.
$ source ~/.bashrc
$ pyenv -v
pyenv 1.2.21
It's done!
Let's update python right away.
$ pyenv install 3.7.4
Downloading Python-3.7.4.tar.xz...
-> https://www.python.org/ftp/python/3.7.4/Python-3.7.4.tar.xz
Installing Python-3.7.4...
BUILD FAILED (Ubuntu 16.04 using python-build 1.2.21)
Inspect or clean up the working tree at /tmp/python-build.20201015120257.27370
Results logged to /tmp/python-build.20201015120257.27370.log
Last 10 log lines:
sys.exit(ensurepip._main())
File "/tmp/python-build.20201015120257.27370/Python-3.7.4/Lib/ensurepip/__init__.py", line 204, in _main
default_pip=args.default_pip,
File "/tmp/python-build.20201015120257.27370/Python-3.7.4/Lib/ensurepip/__init__.py", line 117, in _bootstrap
return _run_pip(args + [p[0] for p in _PROJECTS], additional_paths)
File "/tmp/python-build.20201015120257.27370/Python-3.7.4/Lib/ensurepip/__init__.py", line 27, in _run_pip
import pip._internal
zipimport.ZipImportError: can't decompress data; zlib not available
Makefile:1132: recipe for target 'install' failed
make: *** [install] Error 1
Somehow a new error came out ... I've taken a step forward for the time being, so I'll stop here.
Recommended Posts