一 , 背景
[damon@localhost ~]$ Python3 -m venv pdf_env
Error: Command '['/home/damon/pdf_env/bin/python3', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1.
一 , 解决方法1
[damon@localhost ~]$ python3 -m venv --with-pip pdf_env
[damon@localhost ~]$ source pdf_env/bin/activate
[damon@localhost ~]$curl https://bootstrap.pypa.io/get-pip.py | python
二 , 解决办法2
https://docs.python.org/3.4/library/ensurepip.html
[root@localhost ~]# python3 -m ensurepip --upgrade
Traceback (most recent call last):
File "/usr/lib64/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib64/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/usr/lib64/python3.6/ensurepip/__main__.py", line 5, in <module>
sys.exit(ensurepip._main())
File "/usr/lib64/python3.6/ensurepip/__init__.py", line 232, in _main
default_pip=args.default_pip,
File "/usr/lib64/python3.6/ensurepip/__init__.py", line 129, in _bootstrap
shutil.copy(whl, tmpdir)
File "/usr/lib64/python3.6/shutil.py", line 245, in copy
copyfile(src, dst, follow_symlinks=follow_symlinks)
File "/usr/lib64/python3.6/shutil.py", line 120, in copyfile
with open(src, 'rb') as fsrc:
FileNotFoundError: [Errno 2] No such file or directory: '/usr/lib64/python3.6/ensurepip/_bundled/setuptools-40.6.2-py2.py3-none-any.whl'
[root@localhost ~]# cd /usr/lib64/python3.6/ensurepip/
[root@localhost ensurepip]# ls
__init__.py __main__.py __pycache__ rewheel _uninstall.py
[root@localhost ensurepip]# mkdir _bundled
[root@localhost ensurepip]# cd _bundled
[root@localhost _bundled]# wget https://files.pythonhosted.org/packages/e7/16/da8cb8046149d50940c6110310983abb359bbb8cbc3539e6bef95c29428a/setuptools-40.6.2-py2.py3-none-any.whl
[root@localhost _bundled]# python3 -m ensurepip --upgrade
Traceback (most recent call last):
File "/usr/lib64/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib64/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/usr/lib64/python3.6/ensurepip/__main__.py", line 5, in <module>
sys.exit(ensurepip._main())
File "/usr/lib64/python3.6/ensurepip/__init__.py", line 232, in _main
default_pip=args.default_pip,
File "/usr/lib64/python3.6/ensurepip/__init__.py", line 129, in _bootstrap
shutil.copy(whl, tmpdir)
File "/usr/lib64/python3.6/shutil.py", line 245, in copy
copyfile(src, dst, follow_symlinks=follow_symlinks)
File "/usr/lib64/python3.6/shutil.py", line 120, in copyfile
with open(src, 'rb') as fsrc:
FileNotFoundError: [Errno 2] No such file or directory: '/usr/lib64/python3.6/ensurepip/_bundled/pip-9.0.3-py2.py3-none-any.whl'
[hpoi@hpoi02 ~]$ wget https://files.pythonhosted.org/packages/ac/95/a05b56bb975efa78d3557efa36acaf9cf5d2fd0ee0062060493687432e03/pip-9.0.3-py2.py3-none-any.whl
[root@localhost _bundled]# ls
pip-9.0.3-py2.py3-none-any.whl setuptools-40.6.2-py2.py3-none-any.whl
[root@localhost _bundled]# python3 -m ensurepip --upgrade
Collecting setuptools
Requirement already up-to-date: pip in /usr/local/lib/python3.6/site-packages
完全解决
[root@localhost _bundled]# cd
【centos8使用python3自带的venv创建虚拟环境报错问题】[root@localhost ~]# python3 -m venv pdf_env
四 , 总结pip版本太高了导致的 , pip直接使用python3 get_pip.py安装
推荐阅读
- DNS何时使用TCP协议,何时使用UDP协议?
- Linux系统怎么使用命令行查询公网IP地址
- Xshell中SSH协议远程访问Linux,使用lrzsz工具实现文件上传下载
- 入手快半年,行程6600km,特斯拉model3的使用体验
- 汽车发动机自动启停功能,为什么不建议您使用?
- SpringBoot使用Redis实现 自动缓存 更新 删除
- Mac使用多显示器的几个基本工具和技巧
- 梦见别人使用缝纫机缝衣服 梦见别人使用缝纫机是什么意思
- 浅析哪些站长可以使用百度统计
- 阿里云ECS服务器监控资源使用情况