我想安装miniconda并可以访问conda的软件包,特别是sfepy
。但是我不希望它接管我当前的python定义。我认为conda只是我可以使用的许多Python环境。
最初,我尝试在安装miniconda时停用这两个选项,如下所示。
安装完成后,我将miniconda路径添加到临时cmd
,导航到包含conda.exe
的目录,并尝试安装sfepy
set PATH=C:\ProgramData\Miniconda2;%PATH%
cd C:\ProgramData\Miniconda2\Scripts
conda install sfepy
这将产生错误ImportError: cannot import name requests
。我知道我使用的是正确的python发行版,因为当我输入python
时,我会在cmd
中得到以下内容
Python 2.7.15 |Anaconda, Inc.| (default, May 1 2018, 18:37:09) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
那是Anaconda发行版。更令人惊奇的是,现在我可以通过键入
导入requests
包了
>>> import requests
>>> requests
<module 'requests' from 'C:\Program Files (x86)\Plaxis\PLAXIS 2D\plxscripting\requests\__init__.pyc'>
但是,正如您所见,它是从另一个python安装中导入的。我也知道requests is included with the
conda的安装如下所示:
C:\ProgramData\Miniconda2\Scripts>dir C:\ProgramData\Miniconda2\Lib\site-packages
Volume in drive C is OS
Volume Serial Number is 944A-AABE
Directory of C:\ProgramData\Miniconda2\Lib\site-packages
02-Sep-18 10:45 <DIR> .
02-Sep-18 10:45 <DIR> ..
02-Sep-18 10:44 <DIR> adodbapi
02-Sep-18 10:44 <DIR> asn1crypto
02-Sep-18 10:44 <DIR> asn1crypto-0.24.0-py2.7.egg-info
02-Sep-18 10:44 <DIR> certifi
20-Apr-18 01:53 3,019 certifi-2018.04.16-py2.7.egg-info
02-Sep-18 10:44 <DIR> cffi
02-Sep-18 10:44 <DIR> cffi-1.11.5-py2.7.egg-info
02-Sep-18 10:44 <DIR> chardet
02-Sep-18 10:44 <DIR> chardet-3.0.4-py2.7.egg-info
02-Sep-18 10:45 <DIR> concurrent
02-Sep-18 10:45 <DIR> conda
14-May-18 15:56 9,440 conda-4.5.4-py2.7.egg-info
02-Sep-18 10:44 <DIR> conda_env
02-Sep-18 10:44 <DIR> cryptography
02-Sep-18 10:44 <DIR> cryptography-2.2.2-py2.7.egg-info
31-May-18 22:08 126 easy_install.py
31-May-18 22:09 300 easy_install.pyc
02-Sep-18 10:45 <DIR> enum
02-Sep-18 10:44 <DIR> enum34-1.1.6-py2.7.egg-info
02-Sep-18 10:44 <DIR> futures-3.2.0-py2.7.egg-info
02-Sep-18 10:44 <DIR> idna
02-Sep-18 10:44 <DIR> idna-2.6-py2.7.egg-info
02-Sep-18 10:44 <DIR> ipaddress-1.0.22-py2.7.egg-info
15-Apr-18 21:00 79,852 ipaddress.py
17-Apr-18 17:20 73,435 ipaddress.pyc
02-Sep-18 10:44 <DIR> isapi
02-Sep-18 10:44 <DIR> menuinst
30-May-18 05:08 1,157 menuinst-1.4.14-py2.7.egg-info
02-Sep-18 10:44 <DIR> OpenSSL
02-Sep-18 10:45 <DIR> pip
02-Sep-18 10:44 <DIR> pip-10.0.1-py2.7.egg-info
02-Sep-18 10:44 <DIR> pkg_resources
30-Oct-17 13:41 6,512 pycosat-0.6.3-py2.7.egg-info
30-Oct-17 13:41 86,528 pycosat.pyd
02-Sep-18 10:44 <DIR> pycparser
02-Sep-18 10:44 <DIR> pycparser-2.18-py2.7.egg-info
02-Sep-18 10:44 <DIR> pyOpenSSL-18.0.0.dist-info
02-Sep-18 10:44 <DIR> PySocks-1.6.8-py2.7.egg-info
09-May-18 03:25 138 pythoncom.py
02-Sep-18 10:45 259 pythoncom.pyc
02-Sep-18 10:44 <DIR> pythonwin
02-Sep-18 10:44 <DIR> pywin32-223-py2.7.egg-info
09-May-18 03:26 630 pywin32.pth
09-May-18 03:35 5 pywin32.version.txt
02-Sep-18 10:44 <DIR> pywin32_system32
30-Apr-18 01:47 119 README
02-Sep-18 10:44 <DIR> requests
02-Sep-18 10:44 <DIR> requests-2.18.4-py2.7.egg-info
02-Sep-18 10:45 <DIR> ruamel_yaml
05-Jun-18 18:29 935 ruamel_yaml-0.15.37-py2.7.egg-info
02-Sep-18 10:44 <DIR> setuptools
02-Sep-18 10:44 <DIR> setuptools-39.2.0-py2.7.egg-info
02-Sep-18 10:44 <DIR> six-1.11.0-py2.7.egg-info
17-Sep-17 21:46 30,888 six.py
21-Oct-17 21:32 29,588 six.pyc
21-Dec-17 07:05 32,281 socks.py
27-Feb-18 19:36 26,492 socks.pyc
21-Dec-17 07:05 2,913 sockshandler.py
27-Feb-18 19:36 4,345 sockshandler.pyc
30-Oct-17 13:41 8,806 test_pycosat.py
30-Oct-17 13:41 14,512 test_pycosat.pyc
02-Sep-18 10:44 <DIR> urllib3
02-Sep-18 10:44 <DIR> urllib3-1.22-py2.7.egg-info
02-Sep-18 10:44 <DIR> wheel
02-Sep-18 10:44 <DIR> wheel-0.31.1-py2.7.egg-info
02-Sep-18 10:44 <DIR> win32
02-Sep-18 10:45 <DIR> win32com
02-Sep-18 10:44 <DIR> win32comext
19-Sep-17 22:23 5,785 wincertstore-0.2-py2.7.egg-info
19-Sep-17 22:23 11,873 wincertstore.py
19-Sep-17 22:23 13,141 wincertstore.pyc
20-Sep-17 04:01 863 win_inet_pton-1.0.1-py2.7.egg-info
30-Aug-14 10:58 2,753 win_inet_pton.py
20-Sep-17 04:01 2,452 win_inet_pton.pyc
02-Sep-18 10:44 <DIR> xonsh
06-Mar-18 21:23 164,864 _cffi_backend.pyd
30 File(s) 614,011 bytes
48 Dir(s) 38,983,368,704 bytes free
我只是不知道为什么首先从另一个目录获取它。
我真的不想随便定义路径变量。有什么方法可以从cmd
中生成一个临时环境,该环境可以在需要时为我定义所有环境变量?我不想让conda接管我的系统python ...
谢谢。