我的Mac上有太多的python,并且pip安装没有将安装包安装到正确的python包文件夹中
我想在我的Mac电脑上使用virtualenv,我用pip安装了它:我的Mac上有太多的python,并且pip安装没有将安装包安装到正确的python包文件夹中,python,macos,python-2.7,pip,virtualenv,Python,Macos,Python 2.7,Pip,Virtualenv,我想在我的Mac电脑上使用virtualenv,我用pip安装了它: pip install virtualenv /usr/local/lib/python2.7/site-packages/pip/commands/install.py:194: UserWarning: Disabling all use of wheels due to the use of --build-options / --global-options / --install-options. cmdopt
pip install virtualenv
/usr/local/lib/python2.7/site-packages/pip/commands/install.py:194: UserWarning: Disabling all use of wheels due to the use of --build-options / --global-options / --install-options.
cmdoptions.check_install_build_global(options)
Collecting virtualenv
Using cached virtualenv-15.1.0.tar.gz
Skipping bdist_wheel for virtualenv, due to binaries being disabled for it.
Installing collected packages: virtualenv
Running setup.py install for virtualenv ... done
Successfully installed virtualenv
显然,virtualenv没有安装到正确的Python软件包文件夹中。下面是错误:
virtualenv -p python3 --system-site-packages py3
Traceback (most recent call last):
File "/usr/local/bin/virtualenv", line 6, in <module>
from pkg_resources import load_entry_point
File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3019, in <module>
@_call_aside
File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3003, in _call_aside
f(*args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3032, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 655, in _build_master
ws.require(__requires__)
File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 963, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 849, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'virtualenv==15.1.0' distribution was not found and is required by the application
$ pip3 install virtualenv
/usr/local/lib/python3.6/site-packages/pip/commands/install.py:194: UserWarning: Disabling all use of wheels due to the use of --build-options / --global-options / --install-options.
cmdoptions.check_install_build_global(options)
Collecting virtualenv
Using cached virtualenv-15.1.0.tar.gz
Skipping bdist_wheel for virtualenv, due to binaries being disabled for it.
Installing collected packages: virtualenv
Running setup.py install for virtualenv ... done
Successfully installed virtualenv
virtualenv -p python3 --system-site-packages py3
Traceback (most recent call last):
File "/usr/local/bin/virtualenv", line 6, in <module>
from pkg_resources import load_entry_point
File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3019, in <module>
@_call_aside
File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3003, in _call_aside
f(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3032, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 655, in _build_master
ws.require(__requires__)
File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 963, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 849, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'virtualenv==15.1.0' distribution was not found and is required by the application
pip3 install --install-option="--install-purelib=/python/packages" virtualenv
/usr/local/lib/python3.6/site-packages/pip/commands/install.py:194: UserWarning: Disabling all use of wheels due to the use of --build-options / --global-options / --install-options.
cmdoptions.check_install_build_global(options)
Collecting virtualenv
Using cached virtualenv-15.1.0.tar.gz
Skipping bdist_wheel for virtualenv, due to binaries being disabled for it.
Installing collected packages: virtualenv
Running setup.py install for virtualenv ... error
Complete output from command /usr/local/opt/python3/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/private/var/folders/17/y6xv651n50j6gplk57ythm8m0000gn/T/pip-build-mvjkq8ur/virtualenv/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/17/y6xv651n50j6gplk57ythm8m0000gn/T/pip-y9p6_ro7-record/install-record.txt --single-version-externally-managed --compile --install-purelib=/Library/Python/2.7/site-packages --install-purelib=/python/packages:
running install
running build
running build_py
creating build
creating build/lib
copying virtualenv.py -> build/lib
creating build/lib/virtualenv_support
copying virtualenv_support/__init__.py -> build/lib/virtualenv_support
copying virtualenv_support/argparse-1.4.0-py2.py3-none-any.whl -> build/lib/virtualenv_support
copying virtualenv_support/pip-9.0.1-py2.py3-none-any.whl -> build/lib/virtualenv_support
copying virtualenv_support/setuptools-28.8.0-py2.py3-none-any.whl -> build/lib/virtualenv_support
copying virtualenv_support/wheel-0.29.0-py2.py3-none-any.whl -> build/lib/virtualenv_support
running install_lib
byte-compiling /python/packages/virtualenv.py to virtualenv.cpython-36.pyc
error: [Errno 13] Permission denied: '/python/packages/__pycache__'
----------------------------------------
Command "/usr/local/opt/python3/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/private/var/folders/17/y6xv651n50j6gplk57ythm8m0000gn/T/pip-build-mvjkq8ur/virtualenv/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/17/y6xv651n50j6gplk57ythm8m0000gn/T/pip-y9p6_ro7-record/install-record.txt --single-version-externally-managed --compile --install-purelib=/Library/Python/2.7/site-packages --install-purelib=/python/packages" failed with error code 1 in /private/var/folders/17/y6xv651n50j6gplk57ythm8m0000gn/T/pip-build-mvjkq8ur/virtualenv/
sudo pip3 install --install-option="--install-purelib=/python/packages" virtualenv
/usr/local/lib/python3.6/site-packages/pip/commands/install.py:194: UserWarning: Disabling all use of wheels due to the use of --build-options / --global-options / --install-options.
cmdoptions.check_install_build_global(options)
The directory '/Users/yong/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/yong/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting virtualenv
Downloading virtualenv-15.1.0.tar.gz (1.9MB)
100% |████████████████████████████████| 1.9MB 824kB/s
Installing collected packages: virtualenv
Running setup.py install for virtualenv ... done
Successfully installed virtualenv
virtualenv -p python3 --system-site-packages py3
Traceback (most recent call last):
File "/usr/local/bin/virtualenv", line 6, in <module>
from pkg_resources import load_entry_point
File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3019, in <module>
@_call_aside
File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3003, in _call_aside
f(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3032, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 655, in _build_master
ws.require(__requires__)
File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 963, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 849, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'virtualenv==15.1.0' distribution was not found and is required by the application
ls /usr/local/lib/python3.6/site-packages/
__pycache__ pip pkg_resources setuptools-32.2.0-py3.6.egg-info wheel
easy_install.py pip-9.0.1-py3.6.egg-info setuptools sitecustomize.py wheel-0.29.0-py3.6.egg-info
ls /Library/Python/2.7/site-packages
Flask_MongoRest-0.1.1-py2.7.egg colorclass-2.2.0-py2.7.egg-info idna pyparsing-2.2.0-py2.7.egg-info terminaltables-3.1.0-py2.7.egg-info
Flask_Views-0.2.1-py2.7.egg colorclass-2.2.0-py3.6.egg-info idna-2.5-py2.7.egg-info pyparsing-2.2.0-py3.6.egg-info terminaltables-3.1.0-py3.6.egg-info
Flask_WTF-0.9.5-py2.7.egg coverage-3.7.1-py2.7.egg idna-2.5-py3.6.egg-info pyparsing.py textblob
IPython dateutil jinja2 pyparsing.pyc twisted
Pygments-1.6-py2.7.egg django lxml python_dateutil-2.6.0-py2.7.egg-info urllib3
WTForms-1.0.5-py2.7.egg docopt-0.6.2-py2.7.egg-info mongoengine queuelib urllib3-1.21.1-py2.7.egg-info
__pycache__ docopt-0.6.2-py3.6.egg-info mysql-0.0.1-py2.7.egg-info requests urllib3-1.21.1-py3.6.egg-info
awscli-1.9.12-py2.7.egg docopt.py nameparser requests-2.17.3-py2.7.egg-info virtualenv-15.1.0-py2.7.egg-info
boto docopt.pyc nltk requests-2.17.3-py3.6.egg-info virtualenv-15.1.0-py3.6.egg-info
bs4 docutils nose scrapy virtualenv.py
cerberus eve nose-1.3.1-py2.7.egg simplejson virtualenv.pyc
certifi events packaging six-1.10.0-py2.7.egg-info virtualenv_support
certifi-2017.4.17-py2.7.egg-info flask packaging-16.8-py2.7.egg-info six-1.10.0-py3.6.egg-info werkzeug
certifi-2017.4.17-py3.6.egg-info flask_cuddlyrest packaging-16.8-py3.6.egg-info six.py wtforms
chardet flask_mongoengine pandas six.pyc zmq
chardet-3.0.3-py2.7.egg-info flask_mongoengine-0.7.0-py2.7.egg pattern sklearn
chardet-3.0.3-py3.6.egg-info flask_restful pip_upgrader sphinx
cleancat-0.3-py2.7.egg flask_views pip_upgrader-1.4.0-py2.7.egg-info tablib
colorclass flask_wtf pip_upgrader-1.4.0-py3.6.egg-info terminaltables
我当前的python指向/usr/local/bin/python
,我的pip指向/usr/local/bin/pip
。这是默认pip中的内容:
cat /usr/local/bin/pip
#!/usr/local/opt/python/bin/python2.7
# EASY-INSTALL-ENTRY-SCRIPT: 'pip==9.0.1','console_scripts','pip'
__requires__ = 'pip==9.0.1'
import re
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
sys.exit(
load_entry_point('pip==9.0.1', 'console_scripts', 'pip')()
)
我的virtualenv可执行文件如下:
cat /usr/local/bin/virtualenv
#!/usr/local/opt/python/bin/python2.7
# EASY-INSTALL-ENTRY-SCRIPT: 'virtualenv==15.1.0','console_scripts','virtualenv'
__requires__ = 'virtualenv==15.1.0'
import re
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
sys.exit(
load_entry_point('virtualenv==15.1.0', 'console_scripts', 'virtualenv')()
)
如何清理我的python安装并将pip和virtualenv安装指向当前的python包文件夹?
顺便说一句,如果没有pass pip install option参数,pip install就不会将包安装到当前默认的python包文件夹中
pip install --install-option="--install-purelib=/python/packages" virtualenv
即使在使用了pip3之后,我的python仍然有些奇怪:
virtualenv -p python3 --system-site-packages py3
Traceback (most recent call last):
File "/usr/local/bin/virtualenv", line 6, in <module>
from pkg_resources import load_entry_point
File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3019, in <module>
@_call_aside
File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3003, in _call_aside
f(*args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3032, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 655, in _build_master
ws.require(__requires__)
File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 963, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 849, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'virtualenv==15.1.0' distribution was not found and is required by the application
$ pip3 install virtualenv
/usr/local/lib/python3.6/site-packages/pip/commands/install.py:194: UserWarning: Disabling all use of wheels due to the use of --build-options / --global-options / --install-options.
cmdoptions.check_install_build_global(options)
Collecting virtualenv
Using cached virtualenv-15.1.0.tar.gz
Skipping bdist_wheel for virtualenv, due to binaries being disabled for it.
Installing collected packages: virtualenv
Running setup.py install for virtualenv ... done
Successfully installed virtualenv
virtualenv -p python3 --system-site-packages py3
Traceback (most recent call last):
File "/usr/local/bin/virtualenv", line 6, in <module>
from pkg_resources import load_entry_point
File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3019, in <module>
@_call_aside
File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3003, in _call_aside
f(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3032, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 655, in _build_master
ws.require(__requires__)
File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 963, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 849, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'virtualenv==15.1.0' distribution was not found and is required by the application
pip3 install --install-option="--install-purelib=/python/packages" virtualenv
/usr/local/lib/python3.6/site-packages/pip/commands/install.py:194: UserWarning: Disabling all use of wheels due to the use of --build-options / --global-options / --install-options.
cmdoptions.check_install_build_global(options)
Collecting virtualenv
Using cached virtualenv-15.1.0.tar.gz
Skipping bdist_wheel for virtualenv, due to binaries being disabled for it.
Installing collected packages: virtualenv
Running setup.py install for virtualenv ... error
Complete output from command /usr/local/opt/python3/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/private/var/folders/17/y6xv651n50j6gplk57ythm8m0000gn/T/pip-build-mvjkq8ur/virtualenv/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/17/y6xv651n50j6gplk57ythm8m0000gn/T/pip-y9p6_ro7-record/install-record.txt --single-version-externally-managed --compile --install-purelib=/Library/Python/2.7/site-packages --install-purelib=/python/packages:
running install
running build
running build_py
creating build
creating build/lib
copying virtualenv.py -> build/lib
creating build/lib/virtualenv_support
copying virtualenv_support/__init__.py -> build/lib/virtualenv_support
copying virtualenv_support/argparse-1.4.0-py2.py3-none-any.whl -> build/lib/virtualenv_support
copying virtualenv_support/pip-9.0.1-py2.py3-none-any.whl -> build/lib/virtualenv_support
copying virtualenv_support/setuptools-28.8.0-py2.py3-none-any.whl -> build/lib/virtualenv_support
copying virtualenv_support/wheel-0.29.0-py2.py3-none-any.whl -> build/lib/virtualenv_support
running install_lib
byte-compiling /python/packages/virtualenv.py to virtualenv.cpython-36.pyc
error: [Errno 13] Permission denied: '/python/packages/__pycache__'
----------------------------------------
Command "/usr/local/opt/python3/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/private/var/folders/17/y6xv651n50j6gplk57ythm8m0000gn/T/pip-build-mvjkq8ur/virtualenv/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/17/y6xv651n50j6gplk57ythm8m0000gn/T/pip-y9p6_ro7-record/install-record.txt --single-version-externally-managed --compile --install-purelib=/Library/Python/2.7/site-packages --install-purelib=/python/packages" failed with error code 1 in /private/var/folders/17/y6xv651n50j6gplk57ythm8m0000gn/T/pip-build-mvjkq8ur/virtualenv/
sudo pip3 install --install-option="--install-purelib=/python/packages" virtualenv
/usr/local/lib/python3.6/site-packages/pip/commands/install.py:194: UserWarning: Disabling all use of wheels due to the use of --build-options / --global-options / --install-options.
cmdoptions.check_install_build_global(options)
The directory '/Users/yong/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/yong/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting virtualenv
Downloading virtualenv-15.1.0.tar.gz (1.9MB)
100% |████████████████████████████████| 1.9MB 824kB/s
Installing collected packages: virtualenv
Running setup.py install for virtualenv ... done
Successfully installed virtualenv
virtualenv -p python3 --system-site-packages py3
Traceback (most recent call last):
File "/usr/local/bin/virtualenv", line 6, in <module>
from pkg_resources import load_entry_point
File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3019, in <module>
@_call_aside
File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3003, in _call_aside
f(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3032, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 655, in _build_master
ws.require(__requires__)
File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 963, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 849, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'virtualenv==15.1.0' distribution was not found and is required by the application
ls /usr/local/lib/python3.6/site-packages/
__pycache__ pip pkg_resources setuptools-32.2.0-py3.6.egg-info wheel
easy_install.py pip-9.0.1-py3.6.egg-info setuptools sitecustomize.py wheel-0.29.0-py3.6.egg-info
ls /Library/Python/2.7/site-packages
Flask_MongoRest-0.1.1-py2.7.egg colorclass-2.2.0-py2.7.egg-info idna pyparsing-2.2.0-py2.7.egg-info terminaltables-3.1.0-py2.7.egg-info
Flask_Views-0.2.1-py2.7.egg colorclass-2.2.0-py3.6.egg-info idna-2.5-py2.7.egg-info pyparsing-2.2.0-py3.6.egg-info terminaltables-3.1.0-py3.6.egg-info
Flask_WTF-0.9.5-py2.7.egg coverage-3.7.1-py2.7.egg idna-2.5-py3.6.egg-info pyparsing.py textblob
IPython dateutil jinja2 pyparsing.pyc twisted
Pygments-1.6-py2.7.egg django lxml python_dateutil-2.6.0-py2.7.egg-info urllib3
WTForms-1.0.5-py2.7.egg docopt-0.6.2-py2.7.egg-info mongoengine queuelib urllib3-1.21.1-py2.7.egg-info
__pycache__ docopt-0.6.2-py3.6.egg-info mysql-0.0.1-py2.7.egg-info requests urllib3-1.21.1-py3.6.egg-info
awscli-1.9.12-py2.7.egg docopt.py nameparser requests-2.17.3-py2.7.egg-info virtualenv-15.1.0-py2.7.egg-info
boto docopt.pyc nltk requests-2.17.3-py3.6.egg-info virtualenv-15.1.0-py3.6.egg-info
bs4 docutils nose scrapy virtualenv.py
cerberus eve nose-1.3.1-py2.7.egg simplejson virtualenv.pyc
certifi events packaging six-1.10.0-py2.7.egg-info virtualenv_support
certifi-2017.4.17-py2.7.egg-info flask packaging-16.8-py2.7.egg-info six-1.10.0-py3.6.egg-info werkzeug
certifi-2017.4.17-py3.6.egg-info flask_cuddlyrest packaging-16.8-py3.6.egg-info six.py wtforms
chardet flask_mongoengine pandas six.pyc zmq
chardet-3.0.3-py2.7.egg-info flask_mongoengine-0.7.0-py2.7.egg pattern sklearn
chardet-3.0.3-py3.6.egg-info flask_restful pip_upgrader sphinx
cleancat-0.3-py2.7.egg flask_views pip_upgrader-1.4.0-py2.7.egg-info tablib
colorclass flask_wtf pip_upgrader-1.4.0-py3.6.egg-info terminaltables
您正在python2.7上安装软件包,但随后检查其在python3上的可用性 当您安装多个版本的python时,通常它也会附带自己的pip版本。 e、 g.Python 3也将安装pip3。 在如下目录中查找它,以便: /Library/Frameworks/Python.framework/Versions/3.4/bin/pip3.4 在我的机器上,我还有一个pip3,它指向我的机器上安装的最新版本的python3(在我的例子中是python3.4) 然后你只需做:
pip3 install <yourpackage>
pip3安装
您正在python2.7上安装软件包,但随后检查其在python3上的可用性
当您安装多个版本的python时,通常它也会附带自己的pip版本。
e、 g.Python 3也将安装pip3。
在如下目录中查找它,以便:
/Library/Frameworks/Python.framework/Versions/3.4/bin/pip3.4
在我的机器上,我还有一个pip3,它指向我的机器上安装的最新版本的python3(在我的例子中是python3.4)
然后你只需做:
pip3 install <yourpackage>
pip3安装
为什么不使用pip的绝对路径,或者直接将cd放入包含要使用的pip或python的文件夹中?为特定python版本安装pip时,它总是带有符号链接。例如,在为python3.6安装pip后,您可以将该pip版本称为pip3.6
。为什么不使用pip的绝对路径,或者直接将cd放入包含您要使用的pip或python的文件夹中?为特定python版本安装pip时,它总是带有符号链接。例如,在为python3.6安装pip之后,您可以将该pip版本称为pip3.6
``导入站点模块失败。您的PYTHONPATH指向Python2.x的站点包目录,但您正在运行python3.x!PYTHONPATH当前为::/usr/local/lib/python2.7/site packages“您应该取消PYTHONPATH的设置
,以修复此问题。”如何保持2.7为默认值,并且仍然能够使用3.x?无论您试图运行什么python程序,请确保它调用的是正确的python版本。e、 g.将“shbang”行改为指向python3二进制文件:#/usr/local/bin/python3
(这是一个示例,请在系统上使用python3的正确路径)。或者,您可以像这样调用程序:python3
发生了一些奇怪的事情,我按照您所说的做了,包仍然在python2.7包文件夹中。因此,最终,我将这些文件复制到了我的Python3.6包文件夹中,它成功了cp-R/Library/Python/2.7/site-packages/virtualenv-15.1.0-py3.6.egg-info/usr/local/lib/python3.6/site-packages/cp-R/Library/Python/2.7/site-packages/virtualenv.pyc/usr/local/lib/python3.6/site-packages/cp-R/lib/lib/python3.6/site-packages/code>导入站点失败模块PYTHONPATH指向Python2.x的站点包目录,但您正在运行Python3.x!PYTHONPATH当前为::/usr/local/lib/python2.7/site packages“您应该取消PYTHONPATH的设置
,以修复此问题。”如何保持2.7为默认值,并且仍然能够使用3.x?无论您试图运行什么python程序,请确保它调用的是正确的python版本。e、 g.将“shbang”行改为指向python3二进制文件:#/usr/local/bin/python3
(这是一个示例,请在系统上使用python3的正确路径)。或者,您可以像这样调用程序:python3
发生了一些奇怪的事情,我按照您所说的做了,包仍然在python2.7包文件夹中。因此,最终,我将这些文件复制到了我的Python3.6包文件夹中,它成功了cp-R/Library/Python/2.7/site-packages/virtualenv-15.1.0-py3.6.egg-info/usr/local/lib/python3.6/site-packages/cp-R/Library/Python/2.7/site-packages/virtualenv.pyc/usr/local/lib/python3.6/site-packages/cp-R/lib/lib/python3.6/site-packages/code>