在 Ubuntu 14.06 上正确安装 Python 3.6 以包含 IDLE
Proper installation of Python 3.6 on Ubuntu 14.06 to include IDLE
我正在尝试在 Ubuntu 14.06 上安装 Python 3.6。我已经尝试了 get-apt 命令,并尝试从 tarball 安装。无论哪种方式,这都是我收到的错误。
:~/Downloads$ pip install Python-43.4.6.tar.gz
Requirement 'Python-43.4.6.tar.gz' looks like a filename, but the file does not exist
Processing ./Python-43.4.6.tar.gz
Exception: Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 209, in main status = self.run(options, args)
File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 328, in run wb.build(autobuilding=True)
File "/usr/lib/python2.7/dist-packages/pip/wheel.py", line 748, in build self.requirement_set.prepare_files(self.finder)
File "/usr/lib/python2.7/dist-packages/pip/req/req_set.py", line 360, in prepare_files ignore_dependencies=self.ignore_dependencies))
File "/usr/lib/python2.7/dist-packages/pip/req/req_set.py", line 577, in _prepare_file session=self.session, hashes=hashes)
File "/usr/lib/python2.7/dist-packages/pip/download.py", line 798, in unpack_url unpack_file_url(link, location, download_dir, hashes=hashes) File "/usr/lib/python2.7/dist-packages/pip/download.py", line 705, in unpack_file_url unpack_file(from_path, location, content_type, link) File "/usr/lib/python2.7/dist-packages/pip/utils/__init__.py", line 620, in unpack_file tarfile.is_tarfile(filename) or
File "/usr/lib/python2.7/tarfile.py", line 2622, in is_tarfile t = open(name)
File "/usr/lib/python2.7/tarfile.py", line 1673, in open return func(name, "r", fileobj, **kwargs)
File "/usr/lib/python2.7/tarfile.py", line 1738, in gzopen fileobj = gzip.GzipFile(name, mode, compresslevel, fileobj)
File "/usr/lib/python2.7/gzip.py", line 94, in __init__ fileobj = self.myfileobj = __builtin__.open(filename, mode or 'rb')
IOError: [Errno 2] No such file or directory: '/home/michael/Downloads/Python-43.4.6.tar.gz'
You are using pip version 8.1.1, however version 9.0.1 is available. You should consider upgrading via the 'pip install --upgrade pip' command.
:~/Downloads$ pip install --upgrade pip
Collecting pip
Downloading pip-9.0.1-py2.py3-none-any.whl (1.3MB) 100% |████████████████████████████████| 1.3MB 662kB/s Installing collected packages: pip
Successfully installed pip-8.1.1
You are using pip version 8.1.1, however version 9.0.1 is available. You should consider upgrading via the 'pip install --upgrade pip' command.
~/Downloads$ pip -V
pip 9.0.1 from /home/michael/.local/lib/python2.7/site-packages (python 2.7)
~/Downloads$ python -V
Python 2.7.12
~/Downloads$ python3 -V
Python 3.5.2
我是不是下载了错误的压缩包,或者有没有办法确保我没有安装 Python 2.7?还有,pip版本错误有关系吗?
TIA
首先尝试在 pip 中使用升级命令,看看是否能解决版本问题
pip3 install --upgrade pip
否则我会建议卸载并执行全新安装。
使用以下命令设置python
sudo apt-get update
sudo apt-get -y upgrade
sudo apt-get install python3.6 python3-pip idle3
pip3 install numpy
pip3 install spyder
pip3 是为 python3 使用 python 安装程序的命令。
要使用 idle3,只需输入命令 window
idle3
我建议使用 pip3 安装 spyder,因为 spyder 是一个更高级的 idle,可以跟踪变量和代码编写。更容易定位错误等。
许多 linux 发行版提供 tkinter、IDLE(使用 tkinter)和 turtle(也使用 tkinter)作为单独的发行版。在 SO 中搜索 [tkinter] install tkinter on ubuntu
会显示以前的问题和答案。
sudo apt-get install python3-tk
可能是您所需要的,但与之前的回答相比,详细信息可能有所变化。
我正在尝试在 Ubuntu 14.06 上安装 Python 3.6。我已经尝试了 get-apt 命令,并尝试从 tarball 安装。无论哪种方式,这都是我收到的错误。
:~/Downloads$ pip install Python-43.4.6.tar.gz
Requirement 'Python-43.4.6.tar.gz' looks like a filename, but the file does not exist
Processing ./Python-43.4.6.tar.gz
Exception: Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 209, in main status = self.run(options, args)
File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 328, in run wb.build(autobuilding=True)
File "/usr/lib/python2.7/dist-packages/pip/wheel.py", line 748, in build self.requirement_set.prepare_files(self.finder)
File "/usr/lib/python2.7/dist-packages/pip/req/req_set.py", line 360, in prepare_files ignore_dependencies=self.ignore_dependencies))
File "/usr/lib/python2.7/dist-packages/pip/req/req_set.py", line 577, in _prepare_file session=self.session, hashes=hashes)
File "/usr/lib/python2.7/dist-packages/pip/download.py", line 798, in unpack_url unpack_file_url(link, location, download_dir, hashes=hashes) File "/usr/lib/python2.7/dist-packages/pip/download.py", line 705, in unpack_file_url unpack_file(from_path, location, content_type, link) File "/usr/lib/python2.7/dist-packages/pip/utils/__init__.py", line 620, in unpack_file tarfile.is_tarfile(filename) or
File "/usr/lib/python2.7/tarfile.py", line 2622, in is_tarfile t = open(name)
File "/usr/lib/python2.7/tarfile.py", line 1673, in open return func(name, "r", fileobj, **kwargs)
File "/usr/lib/python2.7/tarfile.py", line 1738, in gzopen fileobj = gzip.GzipFile(name, mode, compresslevel, fileobj)
File "/usr/lib/python2.7/gzip.py", line 94, in __init__ fileobj = self.myfileobj = __builtin__.open(filename, mode or 'rb')
IOError: [Errno 2] No such file or directory: '/home/michael/Downloads/Python-43.4.6.tar.gz'
You are using pip version 8.1.1, however version 9.0.1 is available. You should consider upgrading via the 'pip install --upgrade pip' command.
:~/Downloads$ pip install --upgrade pip
Collecting pip
Downloading pip-9.0.1-py2.py3-none-any.whl (1.3MB) 100% |████████████████████████████████| 1.3MB 662kB/s Installing collected packages: pip
Successfully installed pip-8.1.1
You are using pip version 8.1.1, however version 9.0.1 is available. You should consider upgrading via the 'pip install --upgrade pip' command.
~/Downloads$ pip -V
pip 9.0.1 from /home/michael/.local/lib/python2.7/site-packages (python 2.7)
~/Downloads$ python -V
Python 2.7.12
~/Downloads$ python3 -V
Python 3.5.2
我是不是下载了错误的压缩包,或者有没有办法确保我没有安装 Python 2.7?还有,pip版本错误有关系吗?
TIA
首先尝试在 pip 中使用升级命令,看看是否能解决版本问题
pip3 install --upgrade pip
否则我会建议卸载并执行全新安装。
使用以下命令设置python
sudo apt-get update
sudo apt-get -y upgrade
sudo apt-get install python3.6 python3-pip idle3
pip3 install numpy
pip3 install spyder
pip3 是为 python3 使用 python 安装程序的命令。
要使用 idle3,只需输入命令 window
idle3
我建议使用 pip3 安装 spyder,因为 spyder 是一个更高级的 idle,可以跟踪变量和代码编写。更容易定位错误等。
许多 linux 发行版提供 tkinter、IDLE(使用 tkinter)和 turtle(也使用 tkinter)作为单独的发行版。在 SO 中搜索 [tkinter] install tkinter on ubuntu
会显示以前的问题和答案。
sudo apt-get install python3-tk
可能是您所需要的,但与之前的回答相比,详细信息可能有所变化。