我創建了一個Python 3 virtualenv中,像這樣:PIP內的Python 3安裝錯誤的virtualenv
mkproject -p python3 flowerid
但是,當我嘗試安裝與PIP任何東西(這的virtualenv中)我得到這個錯誤:
cd flowerid
pip install ipython
Traceback (most recent call last):
File "/Users/nicolas/.virtualenvs/flowerid/bin/pip", line 11, in <module>
load_entry_point('pip==9.0.1', 'console_scripts', 'pip')()
File "/Users/nicolas/.virtualenvs/flowerid/lib/python3.6/site-packages/pkg_resources/__init__.py", line 560, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/Users/nicolas/.virtualenvs/flowerid/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2648, in load_entry_point
return ep.load()
File "/Users/nicolas/.virtualenvs/flowerid/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2302, in load
return self.resolve()
File "/Users/nicolas/.virtualenvs/flowerid/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2308, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/Users/nicolas/.virtualenvs/flowerid/lib/python3.6/site-packages/pip/__init__.py", line 28, in <module>
from pip.vcs import git, mercurial, subversion, bazaar # noqa
File "/Users/nicolas/.virtualenvs/flowerid/lib/python3.6/site-packages/pip/vcs/subversion.py", line 9, in <module>
from pip.index import Link
File "/Users/nicolas/.virtualenvs/flowerid/lib/python3.6/site-packages/pip/index.py", line 31, in <module>
from pip.wheel import Wheel, wheel_ext
File "/Users/nicolas/.virtualenvs/flowerid/lib/python3.6/site-packages/pip/wheel.py", line 6, in <module>
import compileall
File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/compileall.py", line 20, in <module>
from concurrent.futures import ProcessPoolExecutor
File "/Library/Python/2.7/site-packages/concurrent/futures/__init__.py", line 8, in <module>
from concurrent.futures._base import (FIRST_COMPLETED,
File "/Library/Python/2.7/site-packages/concurrent/futures/_base.py", line 357
raise type(self._exception), self._exception, self._traceback
^
SyntaxError: invalid syntax
在「期貨」導入到「/Library/Python/2.7」之前,一切看起來都很正常。
我在創建virtualenv時試圖設置「--no-site-packages」,但這並沒有改變任何東西(它不應該是默認設置)。
我試着用pip3代替,同樣的事情。
我試圖與easy_install pip
,同樣的事情重新安裝PIP(在virtualenv中)...
任何其他的想法?謝謝你的幫助。
注意:我通常使用Python 2.7 - 我在全局安裝了很多Python 2.7包 - 也許這就是創建衝突的原因?
我在OSX El Capitan。
更新: 我的virtualenv似乎被激活 - 它開始使用我的virtualenv中的pip和python。而'哪個python'使用virtualenv的python。
(flowerid) [email protected]~/venv_projects/flowerid$ which python
/Users/nicolas/.virtualenvs/flowerid/bin/python
你有沒有任何機會忘了激活的virtualenv? –
'File「/Library/Python/2.7/site-packages ....'注意__2.7__ _Python_版本。 – CristiFati
您是否在運行pip時激活了virtualenv?什麼'哪個python'顯示(或者你使用的任何類似的命令)? – Nurjan