简体   繁体   中英

How to install Jupyter notebook into a linux virtual machine

I'm trying to install Jupyter notebook into a linux virtual machine. I've already gone through all the steps on various different sites but I keep running into different errors, and when I try to use the jupyter command, it says it "is not found", so the installations clearly didn't work. I've been getting errors when trying to use/update pip as well.

What I've done so far:

  • Checked my Python version: I have both Python 2.7 and Python 3.5.2 installed on the VM.

  • I made sure pip was installed. It automatically installed version 8, so I updated it with this sudo python3 -m pip install --upgrade pip . It was working for a bit even though it kept saying there's a newer version available and I should upgrade. However now it just keps giving me the following error anytime I try to use pip for anything (even pip --version to see the version gives this error):

     File "/home/vmadmin/.local/bin/pip", line 7, in <module> from pip._internal.cli.main import main File "/home/vmadmin/.local/lib/python3.5/site-packages/pip/_internal/cli/main.py", line 57 sys.stderr.write(f"ERROR: {exc}") ^
  • Trying to upgrade pip with sudo python3 -m pip install --upgrade pip gives me the following error:

     File "/home/vmadmin/.local/bin/pip", line 7, in <module> from pip._internal.cli.main import main File "/home/vmadmin/.local/lib/python3.5/site-packages/pip/_internal/cli/main.py", line 57 sys.stderr.write(f"ERROR: {exc}") ^
  • And trying to install jupyter with pip3 gives me a similar error:

     File "/home/vmadmin/.local/bin/pip3", line 7, in <module> from pip._internal.cli.main import main File "/home/vmadmin/.local/lib/python3.5/site-packages/pip/_internal/cli/main.py", line 57 sys.stderr.write(f"ERROR: {exc}") ^

I've already tried the solutions from another post that also had a different error I got previously, but they didn't work and I'm just really not sure where to look to solve these errors, so any pointers would be really helpful. My end goal is to get Jupyter notebook installed, configured, and up and running through a port on my Linux VM (Ubuntu 16.04.7).

The issue here is an unsupported syntax. Both Python 2.7 and 3.5 has no longer support by Pip. Newer pip versions introduced string formatting on its code (f-strings):

s = f"Hello, {your_name}"

But this feature was introduced in Python 3.6, that's why everything failed for you. So you should upgrade your Python version.

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