Django/PyCahrm。使用 /venv 将项目迁移到另一台 PC 找不到 `dotenv` 模块并且无法安装它
Django/PyCahrm. Relocation project to another PC with /venv can`t find `dotenv` module and can`t to install it
我将带有 /venv 的 Django 项目 (mysite) 重新定位到另一台计算机。
在第一台电脑上运行良好。 'dotenv' 模块安装在哪里。
在 PyCharm 中,我将项目解释器设置为:
Python 3.7(我的站点)C:\Users\User\mysite\venv\Scripts\python.exe
但是 'python manage.py runserver' 在新电脑中加注:
ModuleNotFoundError: No module named 'dotenv'
但在 ../mysite/venv/Scripts 存在文件中 dotenv.exe。
还有 sobfolder ../venv/lib/site-packages/dotenv/。
在 PyCharm-Settings-Project Interpreter in Package list presense python-dotenv 0.14.0
好的。我尝试通过 pip 安装 dotenv,但它引发了错误:
C:\Users\User\mysite\mysite>pip 安装 dotenv
Collecting dotenv
Using cached https://files.pythonhosted.org/packages/e2/46/3754073706e31670eed18bfa8a879305b56a471db15f20523c2427b10078/dotenv-0.0.5.tar.gz
Complete output from command python setup.py egg_info:
Command "python setup.py egg_info" failed with error code 1 in C:\Temp\pip-wheel-4a1x88l2\distribute\
Traceback (most recent call last):
File "C:\Users\User\Anaconda3\lib\site-packages\setuptools\installer.py", line 126, in fetch_build_egg
subprocess.check_call(cmd)
File "C:\Users\User\Anaconda3\lib\subprocess.py", line 347, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['C:\Users\User\Anaconda3\python.exe', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', 'C:\Temp\tmpz_ip4m3r', '--quiet', 'distribute']' returned n
on-zero exit status 1.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Temp\pip-install-07by3weo\dotenv\setup.py", line 23, in <module>
scripts=['scripts/dotenv']
File "C:\Users\User\Anaconda3\lib\site-packages\setuptools\__init__.py", line 152, in setup
_install_setup_requires(attrs)
File "C:\Users\User\Anaconda3\lib\site-packages\setuptools\__init__.py", line 147, in _install_setup_requires
dist.fetch_build_eggs(dist.setup_requires)
File "C:\Users\User\Anaconda3\lib\site-packages\setuptools\dist.py", line 676, in fetch_build_eggs
replace_conflicting=True,
File "C:\Users\User\Anaconda3\lib\site-packages\pkg_resources\__init__.py", line 766, in resolve
replace_conflicting=replace_conflicting
File "C:\Users\User\Anaconda3\lib\site-packages\pkg_resources\__init__.py", line 1049, in best_match
return self.obtain(req, installer)
File "C:\Users\User\Anaconda3\lib\site-packages\pkg_resources\__init__.py", line 1061, in obtain
return installer(requirement)
File "C:\Users\User\Anaconda3\lib\site-packages\setuptools\dist.py", line 732, in fetch_build_egg
return fetch_build_egg(self, req)
File "C:\Users\User\Anaconda3\lib\site-packages\setuptools\installer.py", line 128, in fetch_build_egg
raise DistutilsError(str(e)) from e
distutils.errors.DistutilsError: Command '['C:\Users\User\Anaconda3\python.exe', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', 'C:\Temp\tmpz_ip4m3r', '--quiet', 'distribute']' returned
non-zero exit status 1.
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Temp\pip-install-07by3weo\dotenv\
我试试这个:pip install --upgrade setuptools
但它没有帮助
如何解决?
pip 安装python-dotenv
(不是 'dotenv')。有效
我将带有 /venv 的 Django 项目 (mysite) 重新定位到另一台计算机。 在第一台电脑上运行良好。 'dotenv' 模块安装在哪里。
在 PyCharm 中,我将项目解释器设置为: Python 3.7(我的站点)C:\Users\User\mysite\venv\Scripts\python.exe
但是 'python manage.py runserver' 在新电脑中加注:
ModuleNotFoundError: No module named 'dotenv'
但在 ../mysite/venv/Scripts 存在文件中 dotenv.exe。 还有 sobfolder ../venv/lib/site-packages/dotenv/。 在 PyCharm-Settings-Project Interpreter in Package list presense python-dotenv 0.14.0
好的。我尝试通过 pip 安装 dotenv,但它引发了错误: C:\Users\User\mysite\mysite>pip 安装 dotenv
Collecting dotenv
Using cached https://files.pythonhosted.org/packages/e2/46/3754073706e31670eed18bfa8a879305b56a471db15f20523c2427b10078/dotenv-0.0.5.tar.gz
Complete output from command python setup.py egg_info:
Command "python setup.py egg_info" failed with error code 1 in C:\Temp\pip-wheel-4a1x88l2\distribute\
Traceback (most recent call last):
File "C:\Users\User\Anaconda3\lib\site-packages\setuptools\installer.py", line 126, in fetch_build_egg
subprocess.check_call(cmd)
File "C:\Users\User\Anaconda3\lib\subprocess.py", line 347, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['C:\Users\User\Anaconda3\python.exe', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', 'C:\Temp\tmpz_ip4m3r', '--quiet', 'distribute']' returned n
on-zero exit status 1.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Temp\pip-install-07by3weo\dotenv\setup.py", line 23, in <module>
scripts=['scripts/dotenv']
File "C:\Users\User\Anaconda3\lib\site-packages\setuptools\__init__.py", line 152, in setup
_install_setup_requires(attrs)
File "C:\Users\User\Anaconda3\lib\site-packages\setuptools\__init__.py", line 147, in _install_setup_requires
dist.fetch_build_eggs(dist.setup_requires)
File "C:\Users\User\Anaconda3\lib\site-packages\setuptools\dist.py", line 676, in fetch_build_eggs
replace_conflicting=True,
File "C:\Users\User\Anaconda3\lib\site-packages\pkg_resources\__init__.py", line 766, in resolve
replace_conflicting=replace_conflicting
File "C:\Users\User\Anaconda3\lib\site-packages\pkg_resources\__init__.py", line 1049, in best_match
return self.obtain(req, installer)
File "C:\Users\User\Anaconda3\lib\site-packages\pkg_resources\__init__.py", line 1061, in obtain
return installer(requirement)
File "C:\Users\User\Anaconda3\lib\site-packages\setuptools\dist.py", line 732, in fetch_build_egg
return fetch_build_egg(self, req)
File "C:\Users\User\Anaconda3\lib\site-packages\setuptools\installer.py", line 128, in fetch_build_egg
raise DistutilsError(str(e)) from e
distutils.errors.DistutilsError: Command '['C:\Users\User\Anaconda3\python.exe', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', 'C:\Temp\tmpz_ip4m3r', '--quiet', 'distribute']' returned
non-zero exit status 1.
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Temp\pip-install-07by3weo\dotenv\
我试试这个:pip install --upgrade setuptools
但它没有帮助
如何解决?
pip 安装python-dotenv (不是 'dotenv')。有效