一、Centos中安装pip3和pip并存
一、python2
1.安装源
yum -y install epel-release
2.安装pip
yum install python-pip
3.对安装好的pip进行升级
pip install --upgrade pip (注意是两个短横线~~)
到这里pip 安装完成,即/usr/bin 目录下有pip , 但注意是python2 下的。
二、python3中pip3的安装
python3 中自带有pip3,因此只需要添加pip3的软链接即可
1.在之前装的python3 的/usr/bin 目录下有pip3 (创建软链接)
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
此时pip 和pip3 均可用~~
————————————————
本文出自:https://blog.csdn.net/gwz_6903/article/details/100678333
二、Centos中升级pip版本
出现“创建失败”这个问题一般是虚拟环境的问题,首先我们进入SSH(服务器命令行),手动安装一下virtualenv
升级pip
#pip3 -V pip 9.0.3 from /usr/lib/python3.6/site-packages (python 3.6)
现在pip版本是9.0.3,安装插件会有警告,先升级pip
#pip3 install --upgrade pip WARNING: Running pip install with root privileges is generally not a good idea. Try `pip3 install --user` instead. Collecting pip Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/43/84/23ed6a1796480a6f1a2d38f2802901d078266bda38388954d01d3f2e821d/pip-20.1.1-py2.py3-none-any.whl (1.5MB) 100% |████████████████████████████████| 1.5MB 95.6MB/s Installing collected packages: pip Successfully installed pip-20.1.1
查看下最新的pip版本
#pip -V pip 20.1.1 from /usr/local/lib/python3.6/site-packages/pip (python 3.6)
pip升级完毕,下面安装virtualenv
#pip install virtualenv Looking in indexes: http://mirrors.cloud.aliyuncs.com/pypi/simple/ Collecting virtualenv Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/57/6e/a13442adf18bada682f88f55638cd43cc7a39c3e00fdcf898ca4ceaeb682/virtualenv-20.0.21-py2.py3-none-any.whl (4.7 MB) |████████████████████████████████| 4.7 MB 13.3 MB/s Collecting appdirs<2,>=1.4.3 Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/3b/00/2344469e2084fb287c2e0b57b72910309874c3245463acd6cf5e3db69324/appdirs-1.4.4-py2.py3-none-any.whl (9.6 kB) Requirement already satisfied: six<2,>=1.9.0 in /usr/local/lib/python3.6/site-packages (from virtualenv) (1.14.0) Collecting importlib-resources<2,>=1.0; python_version < "3.7" Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/7f/2d/88f166bcaadc09d9fdbf1c336ad118e01b7fe1155e15675e125be2ff1899/importlib_resources-1.5.0-py2.py3-none-any.whl (21 kB) Collecting filelock<4,>=3.0.0 Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/93/83/71a2ee6158bb9f39a90c0dea1637f81d5eef866e188e1971a1b1ab01a35a/filelock-3.0.12-py3-none-any.whl (7.6 kB) Collecting distlib<1,>=0.3.0 Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/7d/29/694a3a4d7c0e1aef76092e9167fbe372e0f7da055f5dcf4e1313ec21d96a/distlib-0.3.0.zip (571 kB) |████████████████████████████████| 571 kB 120.4 MB/s Requirement already satisfied: importlib-metadata<2,>=0.12; python_version < "3.8" in /usr/local/lib/python3.6/site-packages (from virtualenv) (1.6.0) Requirement already satisfied: zipp>=0.4; python_version < "3.8" in /usr/local/lib/python3.6/site-packages (from importlib-resources<2,>=1.0; python_version < "3.7"->virtualenv) (3.1.0) Using legacy setup.py install for distlib, since package 'wheel' is not installed. Installing collected packages: appdirs, importlib-resources, filelock, distlib, virtualenv Running setup.py install for distlib ... done Successfully installed appdirs-1.4.4 distlib-0.3.0 filelock-3.0.12 importlib-resources-1.5.0 virtualenv-20.0.21
查看一下virtualenv版本
#virtualenv --version virtualenv 20.0.21 from /usr/local/lib/python3.6/site-packages/virtualenv/__init__.py
————————————————
本文出自:https://blog.csdn.net/ke2100/article/details/106443838/
三、创建虚拟环境
cd 进入项目所在根目录后,执行以下命令创建虚拟环境
python -m venv netease-cloud_venv
好了,现在再重新去python项目管理器创建项目试试,是不是不会出现“创建失败”了
文章评论