简体   繁体   中英

install jupyter notebook in windows

My Python version is 3.6.0 and my operating system is Windows. I want to install jupyter notebook using the order pip install jupyter . But it failed, I got the following error:

在此处输入图片说明

在此处输入图片说明

Three Ways to Run Jupyter In Windows

The "Pure Python" Way

Make your way over to python.org, download and install the latest version (3.5.1 as of this writing) and make sure that wherever you install it, the directory containing python.exe is in your system PATH environment variable. I like to install it in the root of my C: drive, eg C:\\Python35 , so my PATH contains that directory.

Once that's installed, you'll want to create a virtual environment, a lightweight, disposable, isolated python installation where you can experiment and install 3rd party libraries without affecting your "main" installation. To do this, open up a Powershell window, and enter the following commands (where " myenv " is the name of the virtualenv we're going to create, you can use any name you like for this):

PS C:\> python -m venv myenv
PS C:\> myenv\Scripts\activate

Then, let's install jupyter and start up a notebook:

PS C:\> pip install jupyter
PS C:\> jupyter notebook

Incidentally, if you get a warning about upgrading pip, make sure to use the following incantation to upgrade (to prevent an issue on windows where pip is unable to upgrade its own executable in-place):

PS C:\> python -m pip install --upgrade pip

Advantages: Uses "pure" python, official tools, and no external dependencies. Well supported, with plenty of online documentation and support communities.

Disadvantages: While many popular data analysis or scientific python libraries can be installed by pip on windows (including Pandas and Matplotlib), some (for example SciPy) require a C compiler and the presence of 3rd party C libraries on the system which are difficult to install on Windows.

Who is it for? Python users comfortable with the command line and the tools that ship with Python itself.

The Python Distributions

Because of the difficulty mentioned above in getting packages like SciPy installed on Windows, a few commercial entities have put together pre-packaged Python "distributions" that contain most, if not all, of the commonly used libraries for data analysis and/or scientific computing.

Anaconda is an excellent option for this. Download their Python 3.5 installer for Windows, run it, and in your Start menu you'll have a bunch of neat new tools, including an entry for Jupyter Notebook. Click to start it up and it'll launch in the background and open up your browser to the notebook console. It doesn't get any easier than that.

Advantages: Simplest, fastest way to get started and it comes with probably everything you need for your scientific computing projects. And anything it doesn't ship with you can still instalAl via its built in conda package manager.

Disadvantages: No virtualenv support, although the conda package manager provides very similar functionality with the conda create command. Relies on a commercial 3rd party for support.

Who is it for? People who want the quickest, easiest way to get Jupyter notebook up and running (IE, most people).

Docker

Docker is a platform for running software in " containers ", or self-contained, isolated processes. While it may sound similar in concept to python virtual environments, Docker containers are an entirely different kind of technology offering vast flexibility and power. Don't let the flexibility and power and confusing terminology put you off though -- Docker can be easy to get up and running on your PC and has some advantages of its own with respect to Python and Jupyter .

To get started on Windows, download the Docker Toolbox, which contains the tools you need to get up and running. Run the installer and make sure the checkbox to install Virtualbox is checked if you don't already have Virtualbox or another virtualization platform ( like VMWare Workstation ) installed.

Once installed, you'll have a "Docker Quickstart Terminal" shortcut in your Start Menu. Double click that shortcut and it will create your first Docker engine for you and set up everything you need automatically. Once you see a prompt in the terminal, you can use the docker run command to run Docker "images", which you can think of as pre-packaged bundles of software that will be automatically downloaded from the Docker Hub when you run them. There are many images on Docker Hub that offer Jupyter , including the official Jupyter Notebook image, and Anaconda itself if you want the full SciPy stack.

To run just the official Jupyter Notebook image in your Docker engine, type the following into the Docker Quickstart Terminal:

$ docker run --rm -it -p 8888:8888 -v "$(pwd):/notebooks" jupyter/notebook

After all the image's "layers" are downloaded, it will start up. Make a note of the IP address listed in the terminal (for example, 192.168.99.100 ), and point your browser at that IP address, port 8888 (eg http://192.168.99.100:8888 ) and you'll see the familiar Jupyter console , with both Python 2 and Python 3 kernels available.

Advantages: Use the flexibility and power of Docker! Honestly one of my favorite things about Docker is thinking of it as an open software distribution platform for things like the SciPy stack that are hard to install.

Disadvantages: Grapple with the flexibility and power of Docker! There are quite a few "gotchas" to be aware of when dealing with Docker, such as immutable containers, data volumes, arcane commands, and rapidly developing, occasionally buggy tooling.

I met the same problem as yours. I updated my Python to version 3.6.1 and re-install Jupyter notebook. I encounter the first problem UnicodeDecodeError when pip setting up tornado, my system is Windows 8.1 64bit. Here is what I do to solve it:

  • I open the directory ...\\Python\\Python36\\Lib\\site-packages\\tornado where new python installed
  • open the directory ...\\Python\\Python35\\Lib\\site-packages\\tornado where old python installed
  • Then I copy and overwrite all *.py files in new tornado directory form old tornado (Note: my old tornado is the latest 4.4.2)
  • Then I run instruction pip install jupyter notebook again

then the same problem when pip setting up MarkupSafe , I do same as above. This time instruction pip install jupyter notebook do not throw error anymore. And Jupyter notebook works.

I think if you have the old version modules of Jupyter, you can try as what I do, Or think about download the error module manually and place them into right directory.

Hope this can help you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM