If the user name is changed and the home directory is renamed, pyenv may get stuck. This is because the python path referenced by the library in pyenv's environment is usually in your home directory, but it doesn't work. It can be solved by the following method. The correspondence is the same for pyenv-virtualenv. Environment: Ubuntu 16.04
#Get environment name
$ pyenv versions
$ vi ~/.pyenv/versions/Environment name/bin/pip
I think the first line looks like this:
#!/home/Old user name/.pyenv/versions/Environment name/bin/python3.*
This is the so-called shebang that specifies the interpreter to read in the interpreter language. The ID is still old, so change it to a new one.
#!/home/New user name/.pyenv/versions/Environment name/bin/python3.*
Now pip works. After that, you can change it uniformly by reinstalling other libraries.
$ pip freeze > requirements.txt
$ pip install -r requirements.txt
Recommended Posts