Virtual,python創建虛擬環境失敗_virtualenv 創建虛擬環境不成功

 2023-10-06 阅读 31 评论 0

摘要:在阿里云上面的服務器有一臺服務器,我已經安裝好pip和virtualenv,我通過Virtual?virtualenv venv創建虛擬環境的時候提示的錯誤信息如下python env。root@Wireless:~/flasky# virtualenv venvRunning virtualenv with interpreter /usr/bin/python2New pyt

在阿里云上面的服務器有一臺服務器,我已經安裝好pip和virtualenv,我通過

Virtual?virtualenv venv

創建虛擬環境的時候提示的錯誤信息如下

python env。root@Wireless:~/flasky# virtualenv venv

Running virtualenv with interpreter /usr/bin/python2

New python executable in /root/flasky/venv/bin/python2

Not overwriting existing python script /root/flasky/venv/bin/python (you must use /root/flasky/venv/bi ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?n/python2)

Please make sure you remove any previous custom paths from your /root/.pydistutils.cfg file.

Installing setuptools, pkg_resources, pip, wheel...

Complete output from command /root/flasky/venv/bin/python2 - setuptools pkg_resources pip wheel:

Collecting setuptools

Downloading http://mirrors.aliyun.com/pypi/packages/a7/62/3995dc3067cbf8d4a13ddac0f87417b9a08799c586 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?b3faa77d62ad9085de/setuptools-34.1.0-py2.py3-none-any.whl (389kB)

Collecting pkg_resources

Exception:

Traceback (most recent call last):

File "/usr/share/python-wheels/pip-8.1.1-py2.py3-none-any.whl/pip/basecommand.py", line 209, in main

status = self.run(options, args)

File "/usr/share/python-wheels/pip-8.1.1-py2.py3-none-any.whl/pip/commands/install.py", line 328, in ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? run

wb.build(autobuilding=True)

File "/usr/share/python-wheels/pip-8.1.1-py2.py3-none-any.whl/pip/wheel.py", line 748, in build

self.requirement_set.prepare_files(self.finder)

File "/usr/share/python-wheels/pip-8.1.1-py2.py3-none-any.whl/pip/req/req_set.py", line 360, in prep ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?are_files

ignore_dependencies=self.ignore_dependencies))

File "/usr/share/python-wheels/pip-8.1.1-py2.py3-none-any.whl/pip/req/req_set.py", line 512, in _pre ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?pare_file

finder, self.upgrade, require_hashes)

File "/usr/share/python-wheels/pip-8.1.1-py2.py3-none-any.whl/pip/req/req_install.py", line 273, in ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? populate_link

self.link = finder.find_requirement(self, upgrade)

File "/usr/share/python-wheels/pip-8.1.1-py2.py3-none-any.whl/pip/index.py", line 442, in find_requi ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?rement

all_candidates = self.find_all_candidates(req.name)

File "/usr/share/python-wheels/pip-8.1.1-py2.py3-none-any.whl/pip/index.py", line 400, in find_all_c ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?andidates

for page in self._get_pages(url_locations, project_name):

File "/usr/share/python-wheels/pip-8.1.1-py2.py3-none-any.whl/pip/index.py", line 545, in _get_pages

page = self._get_page(location)

File "/usr/share/python-wheels/pip-8.1.1-py2.py3-none-any.whl/pip/index.py", line 648, in _get_page

return HTMLPage.get_page(link, session=self.session)

File "/usr/share/python-wheels/pip-8.1.1-py2.py3-none-any.whl/pip/index.py", line 760, in get_page

resp.raise_for_status()

File "/root/flasky/venv/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/models.py", ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? line 840, in raise_for_status

raise HTTPError(http_error_msg, response=self)

HTTPError: 404 Client Error: Not Found for url: http://mirrors.aliyun.com/pypi/simple/pkg-resources/

----------------------------------------

...Installing setuptools, pkg_resources, pip, wheel...done.

Traceback (most recent call last):

File "/usr/lib/python3/dist-packages/virtualenv.py", line 2363, in <module>

main()

File "/usr/lib/python3/dist-packages/virtualenv.py", line 719, in main

symlink=options.symlink)

File "/usr/lib/python3/dist-packages/virtualenv.py", line 988, in create_environment

download=download,

File "/usr/lib/python3/dist-packages/virtualenv.py", line 918, in install_wheel

call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=SCRIPT)

File "/usr/lib/python3/dist-packages/virtualenv.py", line 812, in call_subprocess

% (cmd_desc, proc.returncode))

OSError: Command /root/flasky/venv/bin/python2 - setuptools pkg_resources pip wheel failed with error ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? code 2

我發現我的系統里有3個版本的pip,如下

pip 9.0.1 from /usr/local/lib/python2.7/dist-packages (python 2.7)

root@Wireless:~/flasky# pip3 -V

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

root@Wireless:~/flasky# pip2 -V

pip 8.1.1 from /usr/lib/python2.7/dist-packages (python 2.7)

我嘗試過升級pip,但最后那個pip8.1無法升級到pip9,好像最高版本就是pip8,我

試過用以下命令進行升級:

pip install -U pip

pip install -U pip2

pip install -U pip3

pip2 install -U pip

pip2 install -U pip2

pip2 install -U pip3

pip3 install -U pip

pip3 install -U pip2

pip3 install -U pip3

試試下面這個

virtualenv venv --python=python3.5

首先你得確認該使用哪個版本的

pip

,如有必要可以這樣嘗試安裝

pip3 install virtualenv

,再執行上面的命令。

版权声明:本站所有资料均为网友推荐收集整理而来,仅供学习和研究交流使用。

原文链接:https://hbdhgg.com/3/122469.html

发表评论:

本站为非赢利网站,部分文章来源或改编自互联网及其他公众平台,主要目的在于分享信息,版权归原作者所有,内容仅供读者参考,如有侵权请联系我们删除!

Copyright © 2022 匯編語言學習筆記 Inc. 保留所有权利。

底部版权信息