這期內(nèi)容當(dāng)中小編將會(huì)給大家?guī)?lái)有關(guān)出現(xiàn)virtualenv -p python3 venv報(bào)錯(cuò)如何解決,文章內(nèi)容豐富且以專業(yè)的角度為大家分析和敘述,閱讀完這篇文章希望大家可以有所收獲。
成都創(chuàng)新互聯(lián)公司成都企業(yè)網(wǎng)站建設(shè)服務(wù),提供網(wǎng)站建設(shè)、成都網(wǎng)站制作網(wǎng)站開(kāi)發(fā),網(wǎng)站定制,建網(wǎng)站,網(wǎng)站搭建,網(wǎng)站設(shè)計(jì),響應(yīng)式網(wǎng)站開(kāi)發(fā),網(wǎng)頁(yè)設(shè)計(jì)師打造企業(yè)風(fēng)格網(wǎng)站,提供周到的售前咨詢和貼心的售后服務(wù)。歡迎咨詢做網(wǎng)站需要多少錢:18982081108root@iZwz982qla1uxm1s5dnyo7Z:/usr/lib/python3/dist-packages/virtualenv-15.0.1.egg-info# virtualenv -p python3 venv Running virtualenv with interpreter /usr/bin/python2 New python executable in /usr/lib/python3/dist-packages/virtualenv-15.0.1.egg-info/venv/bin/python2 Not overwriting existing python script /usr/lib/python3/dist-packages/virtualenv-15.0.1.egg-info/venv/bin/python (you must use /usr/lib/python3/dist-packages/virtualenv-15.0.1.egg-info/venv/bin/python2) Please make sure you remove any previous custom paths from your /root/.pydistutils.cfg file. 1 [global] Installing setuptools, pkg_resources, pip, wheel... Complete output from command /usr/lib/python3/dis...nfo/venv/bin/python2 - setuptools pkg_resources pip wheel: Collecting setuptools Downloading http://mirrors.aliyun.com/pypi/packages/ff/f4/385715ccc461885f3cedf57a41ae3c12b5fec3f35cce4c8706b1a112a133/setuptools-40.0.0-py2.py3-none-any.whl (567kB) 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 prepare_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 _prepare_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_requirement 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_candidates 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 "/usr/lib/python3/dist-packages/virtualenv-15.0.1.egg-info/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 /usr/lib/python3/dis...nfo/venv/bin/python2 - setuptools pkg_resources pip wheel failed with error code 2
看到HTTPError: 404 Client Error: Not Found for url: http://mirrors.aliyun.com/pypi/simple/pkg-resources/以為是阿里云的安全組配置沒(méi)配好,折騰了半天,原來(lái)是訪問(wèn)PyPI鏡像源出了問(wèn)題,將pip的默認(rèn)的源地址改為國(guó)內(nèi)源即可。
vim ~/.pip/pip.conf打開(kāi)pip配置文件:
寫入
[global] index-url = http://e.pypi.python.org/simple
以下這幾個(gè)國(guó)內(nèi)源都可以
e.pypi.python.org
pypi.douban.com
pypi.hustunique.com
補(bǔ)充:使用virtualenv創(chuàng)建Python3.7虛擬環(huán)境時(shí)報(bào)錯(cuò)ModuleNotFoundError: No module named '_ctypes'的解決方法
使用virtualenv創(chuàng)建Python3.7.6版本虛擬環(huán)境時(shí),遇到了標(biāo)題中的報(bào)錯(cuò),記錄一下解決過(guò)程。
在安裝3.7以上版本時(shí),需要一個(gè)新的libffi-devel包做依賴
使用yum安裝依賴
yum install libffi-devel -y
刪除之前安裝的報(bào)錯(cuò)的虛擬環(huán)境目錄
rm -f venv
重新編譯安裝系統(tǒng)Python3.7.6(需要先找到安裝時(shí)的Python源碼包,cd到目錄中)
./configure --prefix=/usr/local/python3 make && make install
刪除之前建立的軟連接
rm -rf /usr/bin/python3 rm -rf /usr/bin/pip3
重新建立軟連接
ln -s /usr/local/python3/bin/python3.7 /usr/bin/python3 ln -s /usr/local/python3/bin/pip3.7 /usr/bin/pip3
到此Python3重新安裝完成,可以用python3、pip3命令測(cè)試一下是否安裝成功。
進(jìn)入虛擬目錄將要存放的目錄,使用新安裝的Python3創(chuàng)建虛擬環(huán)境。此處需要使用-p參數(shù)指定Python版本路徑,否則默認(rèn)創(chuàng)建Python2的環(huán)境。
virtualenv -p /usr/bin/python3 venv
測(cè)試進(jìn)入創(chuàng)建好的虛擬環(huán)境中
source venv/bin/activate
退出環(huán)境
deactivate
上述就是小編為大家分享的出現(xiàn)virtualenv -p python3 venv報(bào)錯(cuò)如何解決了,如果剛好有類似的疑惑,不妨參照上述分析進(jìn)行理解。如果想知道更多相關(guān)知識(shí),歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道。
本文標(biāo)題:出現(xiàn)virtualenv-ppython3venv報(bào)錯(cuò)如何解決-創(chuàng)新互聯(lián)
本文URL:http://muchs.cn/article30/iodpo.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供外貿(mào)建站、定制開(kāi)發(fā)、網(wǎng)頁(yè)設(shè)計(jì)公司、微信公眾號(hào)、App開(kāi)發(fā)、標(biāo)簽優(yōu)化
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容