Everything from building a Python environment to running it on Windows

When building the Python environment, I went through various articles because "authentication proxy settings, coexistence environment, and execution confirmation are required", so I think it would be good to put them together.

Introduction

Contents

The contents introduced in this article are as follows. Please skip the authentication proxy and coexistence environment construction if necessary.

Who is it for

For Python beginners who have any of the following:

environment

The environment whose operation has been confirmed is as follows.

procedure

Install Anaconda

Anaconda.PNG

Confirmation of setting information at the time of installation

AnacondaPrompt.png

C:\Users\User name>conda info -e

# conda environments:
#
root                  *  C:\Users\User name\Anaconda3
C:\Users\User name>python
Python 3.6.1 |Anaconda 4.4.0 (64-bit)| (default, May 11 2017, 13:25:24) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>>exit() 

Authentication proxy settings

(*) If you are in an authentication proxy environment, you cannot execute "Building a coexistence environment" unless you pass the authentication first.

.Describe the "user name", "password", "IP address", and "port number" used for proxy authentication in condarc as follows.[^1]



```yaml
proxy_servers:
    http: http://User name:password@IP address:port number
    https: https://User name:password@IP address:port number

(*) If you cannot create it directly, create an appropriate text file and execute the following.

#Go to the Anaconda3 HOME directory and then run
C:\Users\User name\Anaconda3 >ren <Text file name> .condarc
C:\Users\User name>conda config --show

add_anaconda_token: True
...

proxy_servers:
  http: http://User name:password@IP address:port number
  https: https://User name:password@IP address:port number

...
verbosity: 0

Building a coexistence environment for different versions

# 2.Create a 7-series Python execution environment with the name "py27"
C:\Users\User name>conda create -n py27 python=2.7 anaconda
C:\Users\User name>conda info -e

# conda environments:
#
py27                      C:\Users\User name\Anaconda3\envs\py27
root                  *  C:\Users\User name\Anaconda3
C:\Users\User name>activate py27
(py27) C:\Users\User name>
(py27) C:\Users\User name>python
Python 2.7.13 |Continuum Analytics, Inc.| (default, May 11 2017, 13:17:26) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
>>>

Run the program in interactive mode

>>> print('Hello, world!')
Hello, world!
>>>

I was able to confirm that "Hello, world!" Is displayed.

Run python script

>>>exit() 

helloWorld.py


print('Hello, world!')
(py27) C:\Users\User name>python <Script storage location>\helloWorld.py
Hello, world!

(py27) C:\Users\User name>

(py27) C:\Users\User name>deactivate py27

C:\Users\User name>
C:\Users\User name>python
Python 3.6.1 |Anaconda 4.4.0 (64-bit)| (default, May 11 2017, 13:25:24) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>

This completes the operation check of Python2 series. Following the above, you can check the operation by "Run the program in interactive mode" and "Run the Python script" in the 3rd system as well. [^ 4]

in conclusion

In this article, we have introduced the following contents.

I think it was very easy from installation to execution confirmation.

For me, who mainly used Java, I was surprised that it was too easy to build a coexistence environment for different versions.

Supplement (About coexistence environment construction)

Here are some supplements related to the following commands when building a coexistence environment for different versions.

C:\Users\User name>conda create -n py27 python=2.7 anaconda

Version specification

C:\Users\User name>conda create -n py21 python=2.1
Fetching package metadata ...........

PackageNotFoundError: Package missing in current win-64 channels:
  - python 2.1*
system Specifiable version
2.5 or earlier None
2.6 2.6.8、2.6.9
2.7 2.7.3 ~ 2.7.13
3.1 None
3.2 None
3.3 or later Basically everything is OK

Delete the created environment

C:\Users\User name>conda remove -n <Environment name> --all

reference

[^ 1]: If user / password authentication is not required, delete @ and before.

[^ 2]: If you do not add anaconda to the end, install it later by yourself with `conda install``` etc. You can check what is already installed with conda list ``.

[^ 3]: `source activate``` on Mac and Linux [^ 4]: `print``` behaves differently between the 2nd and 3rd series, but this article introduces how to write it in both environments.

Recommended Posts

Everything from building a Python environment to running it on Windows
Procedure for building a CDK environment on Windows (Python)
Building a Python development environment on Windows -From installing Anaconda to linking Atom and Jupyter Notebook-
Building a Python environment on Mac
Building a Python environment on Ubuntu
Summary from building Python 3.4. * From source to building a scientific computing environment
Building a Python 3.6 environment with Windows + PowerShell
Creating a python virtual environment on Windows
From building a Python environment for inexperienced people to Hello world
From installing Ansible to building a Python environment in Vagrant's virtual environment
Simply build a Python 3 execution environment on Windows
Building a Python environment on a Sakura VPS server
Create a Python virtual development environment on Windows
Build a GVim-based Python development environment on Windows 10 (3) GVim8.0 & Python3.6
Create a comfortable Python 3 (Anaconda) development environment on windows
Building a TensorFlow environment that uses GPU on Windows 10
Build a GVim-based Python development environment on Windows 10 (1) Installation
Build Python environment on Windows
From python to running instance on google cloud platform
How to build a Django (python) environment on docker
Building a Python virtual environment
Build python environment on windows
Create a decent shell and python environment on Windows
Building a Python virtual environment
How to build a Python environment on amazon linux 2
Until you create a machine learning environment with Python on Windows 7 and run it
OpenJTalk on Windows10 (Speak Japanese with Python from environment construction)
How to build a new python virtual environment on Ubuntu
Let's get started with Python ~ Building an environment on Windows 10 ~
Building a Python environment on a Mac and using Jupyter lab
From setting up a Rust environment to running Hello World
Build a GVim-based Python development environment on Windows 10 (2) Basic settings
Building an environment to execute python programs on AWS EC2
I tried changing the python script from 2.7.11 to 3.6.0 on windows10
Until building a Python development environment using pyenv on Ubuntu 20.04
Python environment construction memo on Windows 10
Python 3.6 on Windows ... and to Xamarin.
Anaconda python environment construction on Windows 10
Install python2.7 on windows 32bit environment
Create a Python environment on Mac (2017/4)
Building a virtual environment with Python 3
Create a Linux environment on Windows 10
Create a python environment on centos
Install Python development environment on Windows 10
Build a python3 environment on CentOS7
Update Python on Mac from 2 to 3
Create a Python environment for professionals in VS Code on Windows
I tried to create a server environment that runs on Windows 10
How to rebuild python environment from pyenv on Mac environment (El Capitan)
Example of building python development environment on windows (wsl2, vscode, pipenv)
Build a 64-bit Python 2.7 environment with TDM-GCC and MinGW-w64 on Windows 7
Building a Windows 7 environment for getting started with machine learning with Python
Things to note when running Python on EC2 from AWS Lambda
How to build a Python environment using Virtualenv on Ubuntu 18.04 LTS
Building an environment to run ChainerMN on a GPU instance on AWS
[Pyenv] Building a python environment with ubuntu 16.04
Migrate Django applications running on Python 2.7 to Python 3.5
Building a Python3 environment with Amazon Linux2
Python 2.7, 3.4, 3.5 extension module build environment on Windows
[Kivy] How to install Kivy on Windows [Python]
Build a python environment on MacOS (Catallina)