2020/1/6 Fixed about virtualenv because venv was confused with virtualenv
venv and virtualenv were different ...!
It seems that VSCode natively supports jupyter
, even without a web browser
I was able to operate ʻipynb`.
In this article, I thought "Let's use it!" And created an environment with python3.8
.
There was a clogged part, so this is a shared article that says, "If you do this, it will work."
Create an environment for virtualenv instead of anaconda. </ strong>
OS : Windows10 python : 3.8 editor : VSCode 1.40.2
Put the extension python
in VS Code.
I'm happy if I also include ʻIntelliCode`.
If you don't have virtualenv
, do pip
.
Install virtualenv
>pip install virtualenv
Then create a virtual environment.
\Users\usr1
>mkdir virtualenv
>cd virtualenv
>py -m virtualenv jupyter_env
~~~abridgement~~~
done.(Done when this is displayed)
Then start the created environment.
Start-up
>jupyter_env\Script\activate
(jupyter_env)>
If (jupyter_env)
is displayed before the prompt >
, the startup is complete.
Start VS Code
from the command prompt.
The current position is\User\usr1\virtualenv\
(jupyter_env)>code .
When VSCode starts, display the terminal with Ctrl
+ Shift
+ ~
.
Just in case.
pip upgrade
(jupyter_env)>py -m pip install --upgrade pip
Let's pip
. Other necessary libraries are also included.
(jupyter_env)>pip install jupyter
I need a lot.
Press Ctrl
+ Shift
+ p
to open the command palette.
Once open, type jupyter
and you'll see:
Select Python: Create New Blank Jupyter Notebook
.
A jupyter-like screen was displayed.
Then select the python interpreter
.
Press Ctrl
+ Shift
+ p
to open the command palette.
Once open, type select
and you'll see:
Select Python: Select Interpreter
.
The name of the environment you created will appear, so select it.
Let's move it immediately.
Enter the following in the first cell and press Shift
+ ʻEnter` to execute.
helloworld
print('Hello world!')
It doesn't work.
Apparently there is a problem with the library called tornado
used by jupyter.
Reference: Jupyter Notebook with Python 3.8 --NotImplementedError
I was able to fix it by editing ʻasyncio.py of
tornado`.
\venv\jupyter_env\Lib\site-packages\tornado\platform\asyncio.py
import asyncio #Added below this
import sys
if sys.platform == 'win32':
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
Execute with Shift
+ ʻEnter`.
Hooray! You were able to stand at the starting point!
If you did not set it up, the port may have been used.
jupyter uses the 8888
port by default.
Run netstat
at the command prompt and see if 8888
is being used.
If that doesn't work, you may have failed to build the environment. Please check again.
(If you have any notices such as omission of consideration, please point them out in the comments!)
Let's have a good ** Jupi activity **!
This article is based on articles written by other people.
@ simonritchie's article It seems that the Python extension of VS Code has native support for Jupyter, so I tried using it immediately.
@ matuya's article jupyter notebook in python3.8 venv environment
Recommended Posts