Skip to main content
 首页 » 编程设计

python之无法导入使用 PIP 安装的包

2024年09月07日8Free-Thinker

问题

我不是编程新手,但我是 Python 新手。我正在尝试针对 Coinbase 的 GDAX 市场导入一个名为 GDAX 的包。我已经使用 pip install gdax 和 python -m pip install gdax 按照我在网上找到的与我的问题类似的解决方案安装了它。

包在这两种情况下都已成功安装,但是,当我在 PyCharm 中创建新项目并尝试 import gdax 时,找不到它。我已经尝试了几种不同的关键字搜索来为我的问题找到解决方案,但还没有找到。我已经搜索了关于如何安装 python 中未包含的包的通用教程,看起来我为安装包所做的工作是正确的。

关于我做错了什么或遗漏了什么有什么建议吗?

请您参考如下方法:

解决方法:

启用 Inherit global site-packages 解决了我的问题

要在 PyCharm 中添加/编辑 Python 解释器,请转到:

File -> Settings -> Project: -> Project Interpreter 

按下齿轮按钮并选择更多:

这显示了所有配置的解释器。从这里您可以添加/编辑虚拟环境。

If you want the site-packages of the base interpreter to be visible from the virtual environment, select the check box Inherit global site-packages. If you leave this check box cleared, the new virtual environment will be completely isolated.

( PyCharm Docs )