[英]linux anaconda environment doesn't install modules
I have an anaconda virtual environment set up on a linux box.我在 linux 机器上设置了一个 anaconda 虚拟环境。
The dotenv
module wasn't installed, so I tried to install it. dotenv
模块没有安装,所以我尝试安装它。 It installed successfully:它安装成功:
(virt_env_01) [jm@etl01 testing]$ conda install -c conda-forge python-dotenv
## Package Plan ##
environment location: /home/jm/anaconda3/envs/virt_env_01
added / updated specs:
- python-dotenv
...
Downloading and Extracting Packages
certifi-2018.4.16 | 142 KB | ############################################### | 100%
python-dotenv-0.8.2 | 18 KB | ############################################### | 100%
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
However, when I tried to run the python script using it, I got an error saying no module found.但是,当我尝试使用它运行 python 脚本时,我收到一条错误消息,说没有找到模块。
(virt_env_01) [jm@etl01 testing]$ pytest sql_server_tests.py
platform linux -- Python 3.6.3, pytest-3.2.1, py-1.4.34, pluggy-0.4.0
...
Traceback:
sql_server_tests.py:3: in <module>
import dotenv
ModuleNotFoundError: No module named 'dotenv'
Can someone explain what I've done wrong?有人可以解释我做错了什么吗?
EDIT:编辑:
I am running Pytest above.我在上面运行 Pytest。 So I tried Python and it works fine.
所以我尝试了 Python,它运行良好。 Could pytest be installed outside the virtual environment or something?
pytest 可以安装在虚拟环境之外吗? I don't know how that all works.
我不知道这一切是如何运作的。
conda install -c conda-forge python-dotenv
installs the dotenv
conda install -c conda-forge python-dotenv
安装dotenv
another available installation with help of anaconda package manager is conda install -c travis dotenv
, but it is not compatible with python 3
另一个在anaconda 包管理器帮助下可用的安装是
conda install -c travis dotenv
,但它与python 3
不兼容
The pytest module was out of date. pytest 模块已过时。
After I ran conda install pytest
it worked fine.在我运行
conda install pytest
它运行良好。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.