【发布时间】:2020-11-19 06:32:31
【问题描述】:
这些天我在 python 上安装了自己,我不知道为什么。我的直觉告诉我我正在将我的包安装在某个版本的 python 中,当我访问它们时找不到它们,因为它是错误的路径。我正在使用 venv、python 3.6.5、MacOS。我尝试安装的所有东西都会得到:
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
对于我尝试安装的所有内容。我已经搜索了这个并尝试了修复
pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org <<whateverpackage>>
没有骰子。我可以让 conda 进行安装,但是当我尝试在 python 中初始化时,我找不到模块。这让我觉得正在发生的事情是这些工具安装在不同的路径中。哪个python结果:
$ which python
/Users/myname/.pyenv/shims/python
当我询问安装的软件包时,我也会得到不同的结果:
pip list
DEPRECATION: The default format will switch to columns in the future. You can use --format=. (legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
pip (9.0.3)
setuptools (39.0.1)
诗句
conda list
# packages in environment at /anaconda3:
#
# Name Version Build Channel
anaconda-client 1.7.2 py37_0
anaconda-navigator 1.9.12 py37_0
beautifulsoup4 4.9.1 py37_0
也跑了:
$ brew update && brew upgrade
没有变化。我要疯了,想弄清楚我在哪里丢失了线程。这感觉像是一个来自 venv 的自创问题,但此时我安装的所有软件包似乎都可以在 conda 中运行,但由于 pip 失败,并且当我在命令行访问 python 时都不起作用。
另外,不确定这是否有帮助:我在 conda 中启动了一个虚拟环境,同样的问题。我的路径:
$echo $PATH
/Users/username/.pyenv/shims:/Users/username/.pyenv/shims:/usr/local/Cellar/pyenv-virtualenv/1.1.5/shims:/Users/username/.pyenv/shims:/anaconda3/envs/venv/bin:/Users/username/miniconda3/bin:/Users/username/miniconda2/bin:/Users/username/anaconda3/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/username/Downloads/chromedriver:/opt/X11/bin
和
$echo $PYTHONPATH
什么也没返回。
建议?
【问题讨论】:
-
Python 是在没有 SSL 支持的情况下编译的。你必须解决这个问题。尝试
brew reinstall python并重新创建环境。 -
谢谢@KlausD。;跑了
brew reinstall python;没有骰子。运行 'source deactivate' 然后 pip,结果相同。 -
你必须检查系统Python。
import ssl应该这样做。然后你必须重新创建环境(删除和创建)。 -
你好像同时使用了Conda和pyenv,会不会有冲突?
-
@AMC;如前所述,我最初也是这么认为的,但正如您在下面看到的那样,这是证书问题而不是路径问题。
标签: python python-3.x pip anaconda conda