我已使用virtualenvwrapper
上的python3成功创建了一个/usr/local/bin/python3
的虚拟环境作为默认解释器。我的系统python是python2.7
我不能在这个虚拟环境中使用pip3,因为它一直在默认/usr/lib/python2.7/dist-packages
(python3.3.3)╭ ➜ xxx@xxx:~VIRTUAL_ENV/bin
╰ ➤ pip3.3
Traceback (most recent call last):
File "/home/xxx/virtualenv/python3.3.3/bin/pip3.3", line 7, in <module>
from pip import main
File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 11, in <module>
from pip.basecommand import command_dict, load_command, load_all_commands, command_names
File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 11, in <module>
from pip.baseparser import parser, ConfigOptionParser, UpdatingDefaultsHelpFormatter
File "/usr/lib/python2.7/dist-packages/pip/baseparser.py", line 5, in <module>
import pkg_resources
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 45
def _bypass_ensure_directory(name, mode=0777):
^
SyntaxError: invalid token
我忘记了什么吗?
我还尝试将python3安装到/opt
内的自定义目录中,但这没有帮助。
答案 0 :(得分:0)
知道了。我的系统$PYTHONPATH
包含/usr/lib/python2.7/dist-packages
,因此我只是将其从路径中移除,现在一切正常。