[python] When pipenv install of WSL, python on Windows side is called for some reason

Overview

--When I try to install pipenv in the repository with wsl, I get an error for some reason. .. .. --It seems that it refers to python on the windows side --By specifying python with the full path, the countermeasure is completed for the time being

environment

phenomenon

When I try to install pipenv on a project with WSL for the first time since python3.8, I get an unfamiliar error. .. .. : frowning2:

user@***:~/prj$ pipenv --python 3.8
# ~~Omission~~
'TypeError: write() takes exactly one argument (3 given)\n']

When I read the log properly, it seems that I am reading python on the windows side

OSError: [Errno 8] Exec format error: '/mnt/c/Users/user/AppData/Local/Microsoft/WindowsApps/python.exe'

I tried reverting python to 3.7.4, but it didn't change. .. .. The cause seems to be this # 3488 This issue, state is close, but it seems that it has not been fundamentally resolved. For the time being, there are some emergency measures, so let's do that this time.

Countermeasures

The method is very simple. Specify the python to install directly with the full path instead of specifying the version

#[Method 1] When the version can be specified(Example:3.7.4)
#Please specify the path as a full path(~/.pyenv...Is not possible)
pipenv install --python=/home/username/.pyenv/versions/3.7.4/bin/python

#[Method 2] When inserting global python(Should I stop it? ??)
pipenv install --python=$(which python)

I was a little worried that the global python file /home/username/.pyenv/shims/python seems to change when switching global, so pipenv sees the python file in method 2. It seems that it will change and it will be troublesome. If you do it, it's method 1 (It's troublesome to specify the path ...: rolling_eyes :)

Recommended Posts

[python] When pipenv install of WSL, python on Windows side is called for some reason
Example of building python development environment on windows (wsl2, vscode, pipenv)
A memo for when pip3 is installed with python2.7 for some reason
Install python on WSL
Install python on windows
Install Python (for Windows)
For those who can't install Python on Windows XP
Install watchdog on Windows + Python 3.3
[Python] [Chainer] [Windows] Install Chainer on Windows
Install dlib for Python (Windows)
Install python2.7 on windows 32bit environment
Install Python on Windows + pip + virtualenv
Install Pytorch on Blender 2.90 python on Windows
Install Python development environment on Windows 10
Install confluent-kafka for Python on Ubuntu
Memorandum of understanding when Python is run on EC2 with Apache
[Python] Reason for dtype "int32" in Numpy (Windows environment) (as of September 2020)
Notes for using OpenCV on Windows10 Python 3.8.3.
[Kivy] How to install Kivy on Windows [Python]
Install wsl2 and master linux on windows
When I tried to use Python on WSL (windows subsystem for linux), it got stuck in Jupyter (solved)
I want to use Python in the environment of pyenv + pipenv on Windows 10
Separately install a version of Python that is not pre-installed on your Mac
Install Python3, numpy, pandas, matplotlib, etc. on Windows
(Windows) Causes and workarounds for UnicodeEncodeError on Python 3
Install OpenCV 4.0 and Python 3.7 on Windows 10 with Anaconda
[Python] How to install OpenCV on Anaconda [Windows]
python subprocess, for some reason it doesn't stdout.
Installing TensorFlow on Windows Easy for Python beginners
Eliminates SSL error when PIP Install on Windows.
Install Python and libraries for Python on MacOS Catalina
Install ZIP version Python and pip on Windows 10
Python on Windows
(CMake) Gently install official OpenCV on WSL (C / C ++, Python2, Python3)
Install psycopg2 (pgsql library for python3) on Apple Silicon
[Python] This is easy! Search for tweets on Twitter
When Windows Subsystem for Linux (WSL) cannot be started
Build a Python extension for E-Cell 4 on Windows 7 (64bit)
[Heroku] Memo for deploying Python apps using Heroku on Windows [Python]
Summary of tools for operating Windows GUI with Python
U ^ 2-Net for detecting objects of interest (Windows10, Python3.6)
A memo of installing Chainer 1.5 for GPU on Windows
When OpenCV hconcat gives an error for some reason
[Windows] [Python3] Install python3 and Jupyter Notebook (formerly ipython notebook) on Windows
PIL with Python on Windows 8 (for Google App Engine)
Support for Python 2.7 runtime on AWS Lambda (as of 2020.1)
Procedure for building a CDK environment on Windows (Python)
Compile and install MySQL-python for python2.7 on amazon linux
Install Bash on Ubuntu on Windows, Ruby, Python, Jupyter, etc.
Workaround for the problem that sys.argv is not passed when executing a Python script with only the file name in Python2.7 on Windows