如何在Ubuntu 18上为python 3.7安装pip? [英] How to Install pip for python 3.7 on Ubuntu 18?

查看:144
本文介绍了如何在Ubuntu 18上为python 3.7安装pip?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

编辑18/02: 由于我仍然没有解决方案,因此我将更新到目前为止的知识.

EDIT 18/02: Since I still don't have a solution, I'm updating with what I know so far.

我已经成功安装了python 3.7. 我可以使用pip(或pip3)安装模块,但这些模块已安装在Python 3.6中(随ubuntu一起提供).因此,我无法在python 3.7中导入这些模块(获取未找到的模块) Python 3.7无法识别pip/pip3,因此无法通过pip/pip3安装 我需要python 3.7

I've installed python 3.7 successfully. I can install modules using pip (or pip3) but those modules are installed in Python 3.6 (Comes with ubuntu). Therefore I can't import those modules in python 3.7 (get a module not found) Python 3.7 doesn't recognize pip/pip3, so I can't install through pip/pip3 I need python 3.7

-

我已经在Ubuntu 18.04计算机上安装了Python 3.7.如果相关,请遵循以下说明:

I've installed Python 3.7 on my Ubuntu 18.04 machine. Following this instructions in case it's relevant:

下载:可以从Python网站[1]在桌面上手动安装Python 3.7 在桌面安装上将其解压缩:打开终端(ctrl + shift + T)

Download : Python 3.7 from Python Website [1] ,on Desktop and manually unzip it, on Desktop Installation : Open Terminal (ctrl +shift+T)

Go to the Extracted folder
$ cd ~/Desktop/Python-3.7.0
$ ./configure
$ make
$ sudo make install

将Python 3.7设置为默认Python:

Making Python 3.7 default Python :

$ sudo vim ~/.bashrc
press i
on the last and new line - Type
alias python= python3.7
press Esc
type - to save and exit vim
:wq
now type
$ source ~/.bashrc

从此处: https://www.quora.com/How-can-I-upgrade-Python-3-6-to-3-7-in-Ubuntu-18-04

我已经通过pip install module下载了几个模块,但是当我尝试导入它们时,却得到了ModuleNotFoundError: No module names 'xx'

I've downloaded several modules through pip install module but when I try to import them, I get a ModuleNotFoundError: No module names 'xx'

因此,我做了一些研究,显然是在使用pip进行安装时,它已安装在Python早期版本的模块中. 在某个地方(可能是SO中的一个问题),我找到了使用python3.7 -m pip install module安装模块的建议,但随后我得到了/usr/local/bin/python3.7: no module named pip.

So I did some research and apparently when used pip to install, it installed in the modules in previous version of Python. Somewhere (probably a question in SO) I found a suggestion to install the module using python3.7 -m pip install module but then I get /usr/local/bin/python3.7: no module named pip.

现在,我被卡住了,安装了pip,但显然不适用于Python 3.7.我假设如果可以为Python 3.7安装pip,则可以运行pip install命令并获取所需的模块. 如果是这样,既然已经安装了python 3.7,该如何安装pip?

Now I'm stuck, pip is installed, but apparently not for Python 3.7. I'm assuming that if I can install pip for Python 3.7, I can run the pip install command and get the modules I need. If that is the case, how can I install pip for python 3.7, since it's already installed?

推荐答案

您要查找的命令是:

python3.7 -m pip install pip

我也花了很长时间才能弄清楚这一点.关于此文档的文档位于此处.

Took me a surprisingly long time to figure it out, too. The docs about it are here.

这篇关于如何在Ubuntu 18上为python 3.7安装pip?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆