我希望能够记录如何在PyCharm中的Python 3.6下将包添加到VirtualEnv。
例如,“Unable to locate finder for 'pip._vendor.distlib'” error when using "pip install virtualenv"清楚地表达了与基本问题相同的问题,即当前PyCharm的已知问题,通过命令行命令解决。
我喜欢LUM CLI,它对我来说就像是一种母语,但是我试图为开发人员清楚地记录一些事情,这些开发人员可能对任何类似Unix的CLI感到满意,并且上面问题中的说明要求人们通过CLI解决问题。
有没有办法解决PyCharm中的Pip问题作为IDE,或者将项目附加到VirtualEnv并安装PyPI上表示的包?
我得到的错误消息(好奇)是:
Collecting bleach Downloading bleach-2.0.0-py2.py3-none-any.whl Collecting html5lib>=0.99999999 (from bleach) Downloading html5lib-0.999999999-py2.py3-none-any.whl (112kB) Collecting six (from bleach) Downloading six-1.10.0-py2.py3-none-any.whl Collecting setuptools>=18.5 (from html5lib>=0.99999999->bleach) Downloading setuptools-34.3.2-py2.py3-none-any.whl (389kB) Collecting webencodings (from html5lib>=0.99999999->bleach) Downloading webencodings-0.5.tar.gz Collecting appdirs>=1.4.0 (from setuptools>=18.5->html5lib>=0.99999999->bleach) Downloading appdirs-1.4.3-py2.py3-none-any.whl Collecting packaging>=16.8 (from setuptools>=18.5->html5lib>=0.99999999->bleach) Downloading packaging-16.8-py2.py3-none-any.whl Collecting pyparsing (from packaging>=16.8->setuptools>=18.5->html5lib>=0.99999999->bleach) Downloading pyparsing-2.2.0-py2.py3-none-any.whl (56kB) Installing collected packages: six, appdirs, pyparsing, packaging, setuptools, webencodings, html5lib, bleach Found existing installation: setuptools 18.1 Uninstalling setuptools-18.1: Successfully uninstalled setuptools-18.1 Rolling back uninstall of setuptools You are using pip version 7.1.0, however version 9.0.1 is available. You should consider upgrading via the 'python -m pip install --upgrade pip' command. Exception: Traceback (most recent call last): File "C:\Users\CJSHa\cardshopenv\lib\site-packages\pip-7.1.0-py3.6.egg\pip\basecommand.py", line 223, in main status = self.run(options, args) File "C:\Users\CJSHa\cardshopenv\lib\site-packages\pip-7.1.0-py3.6.egg\pip\commands\install.py", line 299, in run root=options.root_path, File "C:\Users\CJSHa\cardshopenv\lib\site-packages\pip-7.1.0-py3.6.egg\pip\req\req_set.py", line 646, in install **kwargs File "C:\Users\CJSHa\cardshopenv\lib\site-packages\pip-7.1.0-py3.6.egg\pip\req\req_install.py", line 813, in install self.move_wheel_files(self.source_dir, root=root) File "C:\Users\CJSHa\cardshopenv\lib\site-packages\pip-7.1.0-py3.6.egg\pip\req\req_install.py", line 1008, in move_wheel_files isolated=self.isolated, File "C:\Users\CJSHa\cardshopenv\lib\site-packages\pip-7.1.0-py3.6.egg\pip\wheel.py", line 465, in move_wheel_files generated.extend(maker.make(spec)) File "C:\Users\CJSHa\cardshopenv\lib\site-packages\pip-7.1.0-py3.6.egg\pip\_vendor\distlib\scripts.py", line 323, in make self._make_script(entry, filenames, options=options) File "C:\Users\CJSHa\cardshopenv\lib\site-packages\pip-7.1.0-py3.6.egg\pip\_vendor\distlib\scripts.py", line 227, in _make_script self._write_script(scriptnames, shebang, script, filenames, ext) File "C:\Users\CJSHa\cardshopenv\lib\site-packages\pip-7.1.0-py3.6.egg\pip\_vendor\distlib\scripts.py", line 163, in _write_script launcher = self._get_launcher('t') File "C:\Users\CJSHa\cardshopenv\lib\site-packages\pip-7.1.0-py3.6.egg\pip\_vendor\distlib\scripts.py", line 302, in _get_launcher result = finder(distlib_package).find(name).bytes File "C:\Users\CJSHa\cardshopenv\lib\site-packages\pip-7.1.0-py3.6.egg\pip\_vendor\distlib\resources.py", line 297, in finder raise DistlibException('Unable to locate finder for %r' % package) pip._vendor.distlib.DistlibException: Unable to locate finder for 'pip._vendor.distlib'
答案 0 :(得分:0)
来自PyCharm docs, regarding pip:
PyCharm提供了一个专门的工具来安装,卸载和 升级Python包。这样做,如果缺少包装工具, PyCharm建议安装它。
PyCharm使用它可以创建虚拟环境 virtualenv工具。这样做,PyCharm与virtualenv紧密集成, 并支持在IDE中配置虚拟环境。