I want to use Python in the environment of pyenv + pipenv on Windows 10

goal

  1. Switch Python versions with pyenv
  2. Manage packages with pipenv

pyenv-win

1. Unzip pyenv-win

Install using the ZIP in * Installation * on GitHbu.

Download the master branch ZIP and download the directory pointed to by the environment variable % USERPROFILE% (often Expand to C: \ Users \ [username]).

When unzipped, the files and directories below will be unzipped, so change the directory pyenv-win-master to .pyenv.

master.Zip file structure


pyenv-win-master
│  .gitignore
│  .python-version
│  .version
│  LICENSE
│  mirrors.txt
│  README.md
│  requirements.txt
│  setup.py
│  _config.yml
│
├─.github
│  └─ISSUE_TEMPLATE
│          bug_report.md
│          feature_request.md
│
├─pyenv-win
│  │  __init__.py
│  │
│  ├─bin
│  │      pyenv
│  │      pyenv.bat
│  │
│  └─libexec
│          pyenv---version.bat
│          pyenv-commands.bat
│          pyenv-duplicate.bat
│          pyenv-exec.bat
│          pyenv-export.bat
│          pyenv-global.bat
│          pyenv-help.bat
│          pyenv-install.vbs
│          pyenv-local.bat
│          pyenv-rehash.bat
│          pyenv-shell.bat
│          pyenv-shims.bat
│          pyenv-uninstall.vbs
│          pyenv-version.bat
│          pyenv-versions.bat
│          pyenv-whence.bat
│          pyenv-which.bat
│          pyenv.vbs
│
└─tests
        test_install.bat
        test_uninstall.bat

After making changes, use the dir command to locate the pyenv command.

cmd> dir %USERPROFILE%\.pyenv\pyenv-win\bin\pyenv
There is no volume label for drive C.
Volume serial number is BA29-3C85

 C:\Users\example-user\.pyenv\pyenv-win\bin directory

2020/02/09  22:07                55 pyenv
1 file 55 bytes
0 directories 790,862,061,568 bytes of free space

2. Set environment variables

Add one environment variable and add two directories to PATH.

--New environment variables

3. Specify the Python version used by pyenv

--First, check the installable version with pyenv install -l. --Next, install the required version. For 3.8.1, run pyenv install 3.8.1. --And specify the version to use. pyenv local 3.8.1 --Finally, run pyenv rehash to update% USERPROFILE% \ .pyenv \ pyenv-win \ shims% .

4. Check the setting result

Run python --version and pip --version to make sure it is the version you specified.

cmd>python --version
Python 3.8.1

cmd>pip --version
pip 20.0.2 from c:\users\example-user\.pyenv\pyenv-win\versions\3.8.1\lib\site-packages\pip (python 3.8)

5. If it doesn't work

Running python launches Microsoft Store

If you run python and the Microsoft Store below is displayed, there are two possible causes.

  1. The % USERPROFILE% \ .pyenv \ pyenv-win \ shims directory is empty. In this case, run pyenv rehash to update the contents of the% USERPROFILE% \ .pyenv \ pyenv-win \ shims directory.
  2. The order of the directories defined in the environment variable Path is% USERPROFILE% \ AppData \ Local \ Microsoft \ WindowsApps followed by % PYENV% \ shims. In this case, % PYENV% \ shims comes first.

2020-04-18.png

Unable to execute commands for packages installed with pip

Run pyenv rehash to update% PYENV% \ shims.

pipenv

Install with pip and do pyenv rehash.

cmd> pip install pipenv
cmd> pyenv rehash
cmd> pipenv --version
pipenv, version 2018.11.26

Now that the installation is complete, use pipenv install to install the required packages.

Recommended Posts

I want to use Python in the environment of pyenv + pipenv on Windows 10
I want to do pyenv + pipenv on Windows
I want to use the R dataset in python
I installed Pygame with Python 3.5.1 in the environment of pyenv on OS X
I want to display the progress in Python!
I want to batch convert the result of "string" .split () in Python
I want to explain the abstract class (ABCmeta) of Python in detail.
I want to write in Python! (3) Utilize the mock
I want to use Ubuntu's desktop environment on Android for the time being (Termux version-Japanese input in desktop environment)
How to use VS Code in venv environment on windows
I want to use only the normalization process of SudachiPy
[Python] I want to use the -h option with argparse
I want to know the features of Python and pip
I tried changing the python script from 2.7.11 to 3.6.0 on windows10
I set the python operating environment on OSX Yosemite (pyenv + pip)
Example of building python development environment on windows (wsl2, vscode, pipenv)
Django cannot be installed in the development environment of pipenv + pyenv
[Understanding in the figure] Management of Python virtual environment by Pipenv
I want to output the beginning of the next month with Python
I want to use jar from python
I want to build a Python environment
I want to use Linux on mac
How to use python put in pyenv on macOS with PyCall
I wrote the code to write the code of Brainf * ck in python
LINEbot development, I want to check the operation in the local environment
I want to use both key and value of Python iterator
I want to use the Ubuntu desktop environment on Android for the time being (Termux version)
I want to use Ubuntu's desktop environment on Android for the time being (UserLAnd version)
I want to know the population of each country in the world.
When you want to use multiple versions of the same Python library (virtual environment using venv)
(Python Selenium) I want to check the settings of the download destination of WebDriver
I want to sort a list in the order of other lists
I want to use the Django Debug Toolbar in my Ajax application
Environment maintenance made with Docker (I want to post-process GrADS in Python
I want to color a part of an Excel string in Python
I want to use the Qore SDK to predict the success of NBA players
I want to leave an arbitrary command in the command history of Shell
A memorandum because I stumbled on trying to use MeCab in Python
I made a program to check the size of a file in Python
Python: I want to measure the processing time of a function neatly
How to use the C library in Python
I want to do Dunnett's test in Python
I want to use MATLAB feval with python
I want to create a window in Python
Use multiple versions of python environment with pyenv
Summary of how to use MNIST in Python
I want to merge nested dicts in Python
I want to use Temporary Directory with Python2
python development environment -use of pyenv and virtualenv-
I want to use ceres solver from python
How to use tkinter with python in pyenv
I want to customize the appearance of zabbix
I want to use the activation function Mish
Use os.getenv to get environment variables in Python
I want to use complicated four arithmetic operations in the IF statement of the Django template! → Use a custom template
I stumbled on the character code when converting CSV to JSON in Python
I want to use PyTorch to generate something like the lyrics of Japari Park
I want to set a life cycle in the task definition of ECS
Use PIL in Python to extract only the data you want from Exif
Visualize the timeline of the number of issues on GitHub assigned to you in Python
I want to see a list of WebDAV files in the Requests module