简体   繁体   English

python3.7没有名为pip的模块

[英]python3.7 No module named pip

i had a problem with installing packages to new upgraded python to version 3.7我在将软件包安装到新升级的 python 到 3.7 版时遇到问题

When i type:当我输入:

python3.7 -m pip install pip -d

/usr/local/bin/python3.7: No module named pip /usr/local/bin/python3.7:没有名为 pip 的模块

I make easy_install like this: sudo easy_install pip what solve previous problems, but now it create pip3.7 in a weird way.我像这样制作easy_install: sudo easy_install pip解决了以前的问题,但现在它以一种奇怪的方式创建 pip3.7。 Whem i calling for pip3.8 version, this returns me a message:当我要求 pip3.8 版本时,这给我返回了一条消息:

pip3.7 -V

pip 19.2.3 from /usr/local/lib/python3.5/dist-packages/pip (python 3.5) pip 19.2.3 来自 /usr/local/lib/python3.5/dist-packages/pip (python 3.5)

Someone know what i am doing wrong?有人知道我在做什么错吗? I tried many things to resolve it.我尝试了很多方法来解决它。 Reinstall, purge, install with symbolic link from python2 etc.重新安装,清除,使用来自 python2 的符号链接安装等。

There is a script which i used to install python3.7 (i had also a problem with zlib):有一个我用来安装 python3.7 的脚本(我也遇到了 zlib 的问题):

sudo cd /home
sudo wget https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tar.xz
sudo tar xf Python-3.7.3.tar.xz
sudo cd ./Python-3.7.3/
sudo ./configure
sudo make
sudo make install
sudo update-alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3 10
python3 --version

Where is a mistake?哪里有错?

Answer finally i find myself.答案终于我找到了自己。 There: https://linuxize.com/post/how-to-install-python-3-7-on-debian-9/那里: https://linuxize.com/post/how-to-install-python-3-7-on-debian-9/

There with similar errors you can recompile it, even without removal (on secound machine i checked without removal) failed installation before.有类似的错误你可以重新编译它,即使没有删除(在第二台机器上我检查没有删除)之前安装失败。

If someone want to good upgrade with everywith working on debian 9. I recommend that script:如果有人想在 debian 9 上进行良好的升级,我推荐该脚本:

NOW_DIR=$(pwd)
apt update
apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev wget
mkdir ~/python_upgrade
cd ~/python_upgrade
curl -O https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tar.xz
tar -xf Python-3.7.3.tar.xz
cd Python-3.7.3
./configure --enable-optimizations
make -j $(nproc)
make altinstall
python3.7 --version
cd $NOW_DIR
rm -rf ~/python_upgrade

There are minor changes from that commands in tutorial.教程中的命令有细微的变化。 Run above file.sh as root.以 root 身份运行以上file.sh

It can take some times, on my virtual machine with 2 cores during another job it takes 40 minutes.这可能需要一些时间,在我的具有 2 个内核的虚拟机上,在另一项工作中需要 40 分钟。 I hope someone find there good answer, not totally green comments like 'apt install' which is first try action before looking to web.我希望有人在那里找到好的答案,而不是像“apt install”这样的完全绿色评论,这是在寻找 web 之前首先尝试操作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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